TooCooL
TooCooL

Reputation: 21162

how to insert wp shortcode via jQuery

I am using the .html() jquery function to change the content of a div I created. But inserting a shortcode into an .html() function doesnt work in wp! is there another way to instert a shortcode? or maybe another jQuery function I can use so wp will understand the shortcode?

jQuery('.reihenhaus').click(function(){
    jQuery('#mehr_infoz').html('Reihnaus Gr&ouml;&szlig;en von 120m&sup2; bis 166m&sup2; <br/><br/>[tabs tab1="Tab 1" tab2="Tab 2" tab3="Tab 3"][tab]Tab 1 Content [/tab][tab]Tab 2 Content[/tab] [tab]Tab 3  Content [/tab][/tabs] Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.')
});

Upvotes: 0

Views: 2603

Answers (1)

adamdehaven
adamdehaven

Reputation: 5920

Since Wordpress is based on PHP (Server-executed code) you cannot add a shortcode to the page after the page has loaded with jQuery. The shortcode needs to be processed by the server BEFORE the page is loaded.

Upvotes: 1

Related Questions