2
我不知道爲什麼我得到這個錯誤,儘管包括一個Jquery庫。 我的代碼:
function create() {
var employeeForm = $("#createUser").serializeJSON();
var employee = JSON.stringify(employeeForm);
$.ajax({
url: uric,
type: 'POST',
data: employee,
success: function(results) {
}
});
庫:
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
什麼可能我會丟失???
** 1。**您已經包含jQuery兩次。 ** 2。**使用[** serialize **](https://api.jquery.com/serialize/)或[** serializeArray **](https://api.jquery.com/serializeArray/) 。 ** 3。**要使用'serializeJSON',您需要在jQuery之後包含https://github.com/marioizquierdo/jquery.serializeJSON庫 – Tushar
您正在導入jQuery兩次 - 爲什麼?你在哪裏得到'.serializeJSON()'是jQuery的一部分? – Pointy
好的。所以我需要包含github.com/marioizquierdo/jquery.serializeJSON,對吧?我感到很困惑。 – tabby