Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 加载页面时出错_Jquery_Ajax - Fatal编程技术网

Jquery 加载页面时出错

Jquery 加载页面时出错,jquery,ajax,Jquery,Ajax,我的jquery手机页面上有一个脚本,它调用一个插入脚本(untitled.asp)来插入数据,但当我按下submit按钮时,它告诉我加载页面时出错,它不起作用 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xh

我的jquery手机页面上有一个脚本,它调用一个插入脚本(untitled.asp)来插入数据,但当我按下submit按钮时,它告诉我加载页面时出错,它不起作用

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.min.css" />
    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.min.js"></script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form action="" method="POST" name="form1" id="form1">
  <table width="327" border="0">
    <tr>
      <td width="88">Item</td>
      <td width="185"><label for="item_name"></label>
        <input type="text" name="item_name" id="item_name" /></td>
    </tr>
    <tr>
      <td>Quantity</td>
      <td><label for="quantity"></label>
        <input type="text" name="quantity" id="quantity" /></td>
    </tr>
    <tr>
      <td>Price</td>
      <td><label for="price"></label>
        <input type="text" name="price" id="price" /></td>
    </tr>
    <tr>
      <td colspan="2">&nbsp;
        <input type="submit" value="Submit" /></td>
    </tr>
  </table>
</form>



   <script>
$(document).ready(function(){
    $("form").on('submit',function(event){
    event.preventDefault();

        data = $(this).serialize();

        $.ajax({
        type: "POST",
        url: "untitled.asp",
        data: data
        }).done(function( msg ) {
        alert( "Data Saved: " + msg );
        });
    });
});
</script>
</body>
</html>

无标题文件
项目
量
价格
$(文档).ready(函数(){
$(“表格”)。在('submit',函数(事件){
event.preventDefault();
数据=$(this).serialize();
$.ajax({
类型:“POST”,
url:“untitled.asp”,
数据:数据
}).done(函数(msg){
警报(“保存的数据:“+msg”);
});
});
});
它在网站上运行良好,但当将其放入移动应用程序时,会弹出此错误

[ValidateAntiForgeryToken]控制器操作结果上的注释可能导致“错误加载页面”


哪个错误?您能在控制台窗口上发布错误吗?请从表单标记中删除“操作”和“方法”。@sujata。怎样?因为如果我删除它,代码就会被破坏。
    [AllowAnonymous]
    [HttpPost]
  //  [ValidateAntiForgeryToken]  this line caused error loading page
    public ActionResult Submit(Model model)
    {