添加查询字符串URL的Ajax调用 [英] Adding query string to Ajax url call

查看:127
本文介绍了添加查询字符串URL的Ajax调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想KN是有可能通过查询字符串与URL时,我们jQuery的Ajax调用;

I wanna kn is it possible to pass query string along with URL when we call on Jquery Ajax;

例如:

    $.ajax({
           type: "POST",
           url: "index.php?task=addNewInfo",
           data: $('#regForm').serialize(),
           dataType: "json",
              .....
      });  

所以呢从参数任务的查询字符串正常工作?或者我们需要做的其他方式? 谢谢你。

So does the query string from the param task works fine? or we need to do it the other way? Thank you.

推荐答案

发送任务中的数据参数

data:"task=addNewInfo&" + $('#regForm').serialize()

这是使用POST方法。 如果你想使用GET方法,那么阿朗的解决方案将正常工作。

This is for using POST method. If you want to use GET method then Arun's solution will work fine.

这篇关于添加查询字符串URL的Ajax调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆