JQuery $.ajax – success event not firing

Using JQuery to post data I had problems with the success event not firing.

$.ajax({ url: myUrl, data: JSON.stringify({ stuff: stuffData }),type: ‘POST’,dataType: ‘json’, contentType: ‘application/json; charset=utf-8’,success: function () { alert(‘Im back!’); } });

I could use alternative options like the Status property to catch 200 as success …. but as it turns out, removing the (redundant) “dataType: ‘json'” property fixed the problem and my success function kicked back in.

StackOverflow post on the subject

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s