星期一, 7月 04, 2011

[jQuery API] How to post JSON data to Server 如何送json格式到server

If you want to post JSON data to server using ajax() method, processData must be set to false.

Tips:requestBODY is JSON string.



$.ajax({
       type : "POST",
       url : endpoint,
       contentType : "application/json",
       dataType : "json",
       processData : false,
       data : requestBODY,
       success : function(data) {
       
       },
       error : function() {
        
       }
      });

沒有留言:

張貼留言

留個話吧:)

其他你感興趣的文章

Related Posts with Thumbnails