0
這裏是我的Ajax請求:阿賈克斯帖子內容類型:應用程序/ Json的阻止請求
$.ajax({ url: '', type: 'POST', data: JSON.stringify({country : jcountry, region : jregion, from : jfrom, to : jto, currency : jcurrency}), processData : false, Content-Type : 'application/json' , dataType: 'json', success: function() { alert("success") $.mobile.changePage("menu1.html"); }, error: function (xhr, ajaxOptions, thrownError) { alert("Error: " + xhr.status + "\n" + "Message: " + xhr.statusText + "\n" + "Response: " + xhr.responseText + "\n" + thrownError); $.mobile.changePage("menue2.html"); } });
如果我沒有精確的內容類型,我不能再看到我與螢火蟲的要求。 相反,當我添加一個內容類型時,我可以看到POST請求(錯誤導致我的URL爲false),但在我的頭文件中,內容類型默認爲url編碼形式。
我想要的是通過JSON數據發送我的表單的詳細信息。 thanx您的幫助