2016-11-10 50 views
0

我傳遞的數據通過這個代碼,但它不工作:傳遞數據沒有成功

$.ajax({ 
       url: '@Url.Action("Edit_we","storemanager")', 
       type: "POST", 
       data: JSON.stringify(obj), 
       dataType: "json", 

       contentType: "application/json; charset=utf-8", 
       success: function(data) 
      { 
       alert("your data is saved") 

      }, 
       error: function() { 
        alert("An error has occured!!!"); 
       } 
      }); 

回答

0
$.ajax({ 
    url: "service.xxx", 
    type: "POST", 
    data: {variable: JSON.stringify(obj)}, 
    dataType: "json", 
    success: function(data) 
     { 
      alert("your data is saved") 

     }, 
    error: function() { 
      alert("An error has occured!!!"); 
     } 
}); 

url爲您支持的服務提供絕對或相對路徑,並使用一個變量來接受數據從前端。

相關問題