dqprf0976 2010-02-05 09:24 采纳率: 100%
浏览 19
已采纳

Ajax是“获取”而不是“发布”

I am trying to use the Post Method in my jquery code but it using the Get method for some reason. I am working under the Wordpress Framework which have renamed the "$" function to jquery, which I then renamed to $j. Can anyone help me with this simple function?

  $j.ajax({
method: "POST",
url: "extension/marker.php",
data: "series=test",
dataType: "text",
success: function(data){ 
 $j("#text").text(data);
 console.log('success' + data);
 }
});

PHP File:

  <?php 

  if($_POST['series'] == "test")
   echo 'yay!';

  if($_GET['series'] == "test")
   echo 'boo!';

  ?>
  • 写回答

1条回答 默认 最新

  • dongluan0020 2010-02-05 09:28
    关注

    method: "POST" should be type: "POST". See the docs.

    type
    Default: 'GET'
    The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥200 相机拍直接转存到电脑上 立拍立穿无线局域网传
  • ¥15 (关键词-电路设计)
  • ¥15 如何解决MIPS计算是否溢出
  • ¥15 vue中我代理了iframe,iframe却走的是路由,没有显示该显示的网站,这个该如何处理
  • ¥15 操作系统相关算法中while();的含义
  • ¥15 CNVcaller安装后无法找到文件
  • ¥15 visual studio2022中文乱码无法解决
  • ¥15 关于华为5g模块mh5000-31接线问题
  • ¥15 keil L6007U报错
  • ¥15 webapi 发布到iis后无法访问