我在我的jquery移动页面上有这个脚本,它调用插入脚本(untitled.asp)来插入数据,但是当我按下提交按钮时它会告诉我错误加载页面并且它不起作用
<!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">
<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>
它在网站上运行正常但是当它放入移动应用程序时会弹出此错误
答案 0 :(得分:0)
[AllowAnonymous]
[HttpPost]
// [ValidateAntiForgeryToken] this line caused error loading page
public ActionResult Submit(Model model)
{