0

One thing that really confuse me is the following:

When I load a javascript file via Ajax and I watch the http requests thats being made, then I see the following error in Firebug: admin-ajax.php (aborted)

Please see this picture:

enter image description here

It is this jquery get file function that's causing this error:

jQuery.get('/assets/js/shop.js', function(data) { eval(data); }); 

If I remove the above script, then there is no error anymore.

Any suggestions?

EDIT1:

I already see why it's giving these aborted errors. In the shop.js file there are some calls to the admin-ajax.php:

/* <![CDATA[ */
var wc_cart_fragments_params = {"ajax_url":"\/wp-admin\/admin-ajax.php","fragment_name":"wc_fragments"};
/* ]]> */

Should I place these CDATA in the body of my html or do I need to do something else?

1

Are there any Console js errors? The admin-ajax.php is Wordpress's built in way of dealing with ajax so you should probably do something like this, assuming .get() would also work:

$.post(ajaxurl, data, function(response) {
    alert('Got this from the server: ' + response);
});

http://codex.wordpress.org/AJAX_in_Plugins

  • No there are no console errors. Please see the edit in my question. – Eric Aug 22 '14 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.