ie7具有AJAX功能的预期标识符,字符串或数字

tat*_*y27 3 ajax jquery cross-browser internet-explorer-7

AJAX用来更新数据库,它适用于所有浏览器,除了IE7.在我放弃并决定要求用户IE7升级之前,我认为我会检查并确保我没有遗漏一些明显的东西,因为我很新AJAX.

脚本调试会抛出一个错误,指出' SCRIPT1028: Expected identifier, string or number'将违规字符标识为倒数第二个大括号

<script>
  function save_pos_reasons()
  {
    $.ajax({
    type: "POST",
    url: "save_pos_reasons.php",
    data: $('#add_positioning').serialize(),
    });
 }
</script>
Run Code Online (Sandbox Code Playgroud)

当我尝试运行它所说的功能时

SCRIPT5007: The value of the property 'save_pos_reasons' is null or undefined, not a function object.

并将下面的行标识为原因.

<input type="button" class="submit" value="Save" onClick="save_pos_reasons()"/>
Run Code Online (Sandbox Code Playgroud)

我开始怀疑它是否JQuery serialize function正在挣扎

Tow*_*ler 6

你必须摆脱尾随的逗号.

data: $('#add_positioning').serialize(), //this comma is the culprit
Run Code Online (Sandbox Code Playgroud)