zoukankan      html  css  js  c++  java
  • WebForm下的$.ajax中contentType: “application/json” 的用法

    不使用contentType: “application/json”则data可以是对象

    1 $.ajax({
    2 url: actionurl,
    3 type: "POST",
    4 datType: "JSON",
    5 data: { id: nodeId },
    6 async: false,
    7 success: function () {}
    8 });

    使用contentType: “application/json”则data只能是json字符串

    1 $.ajax({
    2 url: actionurl,
    3 type: "POST",
    4 datType: "JSON",
    5 contentType: "application/json"
    6 data: "{'id': " + nodeId +"}",
    7 async: false,
    8 success: function () {}
    9 });
     
  • 相关阅读:
    心得
    第七章
    第六章
    第五章
    第四章
    第三章
    第二章
    第一章
    实验2(4)
    实验2(3)
  • 原文地址:https://www.cnblogs.com/yangwujun/p/7681337.html
Copyright © 2011-2022 走看看