Asif hhh
Asif hhh

Reputation: 1552

Prototype AJAX responsetext missing the javascript

I can find the JS and HTML code in response by alert(). But i cannot append JS from response to body tag however HTML is appending fine.

new Ajax.Request(product_url, {
    method: 'post',
    onSuccess: function(transport) {
         $$('body')[0].insert(transport.responseText);
    }
});

Upvotes: 1

Views: 742

Answers (1)

Asif hhh
Asif hhh

Reputation: 1552

      new Ajax.Request(product_url, {
           method: 'post',
          onSuccess: function(transport) {

               $$('body')[0].insert(new Element("div",{id:"popup"}));
               $('popup').innerHTML = transport.responseText;
      }
    });

this gives the solution.

Upvotes: 1

Related Questions