如何发送ajax POST请求

问题描述:

我正在使用此方法发送post请求,但它给了我错误500内部错误jquery.1.11.1.min.js。如何发送ajax POST请求

 $(document).ready(function() { 
      $.ajax({ 
       type: "POST", 
       url: '@Url.Action("cashondelivery", "Home")', 
       data: "", 
       dataType: "json", 
       contentType: 'application/json; charset=utf-8', 
       success: function (result) { 
        alert(result); 
       }, 
       error: function (data) { 

        alert(data); 

       } 
      }); 

     }); 

    //this is action method in controller 
    [HttpPost] 
    public ActionResult cashondelivery(productinfoModel mmodel) 
    { 
     return View(); 
    } 
+0

请参阅此链接http://*.com/questions/1349118/jquery-ajax-post-results-in-500-internal-server-error –

+0

它在localhost上运行良好,但在godaddy上载后出错 – shweta

+0

我认为文件权限问题。请给予你想调用ajax的这个文件的权限。 –

尝试拨打DHC(铬插件)的URL,响应状态代码500表示服务器内部错误,这是服务器的Web应用程序开发人员的错误。不是你的错误。