Tuesday 21 January 2014

[SOLVED] JQuery - AJAX 500 Internal Server Error - JSON - jQueryAjax

Leave a Comment


The above error always occur if you work with jQuery + Ajax.

The error above may have several reason why the error occur and one of the reason is you are using the different parameter name to post to the server. Let say the method getState in webservice require one parameter which will represent country name, you must use the exactly name parameter to request from webservice.



The Other Reason

  1. Not using JSON.stringify to pass parameter value.
  2. If you not supply type in jQuery, it will use GET method which is not accept in your webservice configuration. Add  ( type : "POST ) in your jQuery code to use POST method.
  3. You are actually request data from different domain. Cross Domain Request (CORS)which is not allowed. Please read here
  4. Content type not supply or not correct. Use "application/json; charset=utf-8"
  5. DataType not not supply or not correct. Use json or jsonp

By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

0 comments:

Post a Comment

Subscribe to our newsletter to get the latest updates to your inbox.

Your email address is safe with us!




Founder of developersnote.com, love programming and help others people. Work as Software Developer. Graduated from UiTM and continue study in Software Engineering at UTMSpace. Follow him on Twitter , or Facebook or .



Powered by Blogger.