简体   繁体   English

jQuery .post Ajax函数在IE + FF中不起作用

[英]jquery .post ajax function not working in IE + FF

I'm developing a site for my sports team. 我正在为我的运动队开发一个网站。 It's displaying the next training and match dates from data in aa MySQL database through PHP. 它通过PHP显示MySQL数据库中数据的下一个训练和匹配日期。 I want to let the user add their presence on these appointments and update the div with confirmed users through AJAX. 我想让用户在这些约会中添加他们的存在,并通过AJAX与确认的用户一起更新div。

I call the next function for it : 我为此调用下一个函数:

function swapContent(div, status, soort, itemid, userid) {
$("#"+div).html('<p>loading ...</p>').show();
    var url = "training.php";
    $.post(url, {status: status, soort: soort, itemid: itemid, userid: userid} ,function(data) {
    $("#"+div).html(data).show();
    });
}

The problem is that it's working like a charm in Chrome, but not on FF and IE, both latest versions... 问题在于它在Chrome中都像魅力一样工作,但在FF和IE(这两个最新版本)上却无法正常工作...

Any tips? 有小费吗?

It is possible that they are having issues with the naming you used, ie: 他们使用的命名可能存在问题,即:

status: status

try changing the argument names for the function and see if it helps. 尝试更改函数的参数名称,看看是否有帮助。

I've got it solved. 我已经解决了。 As you can see I'm passing the var $userid with the .post. 如您所见,我将.user传递给$ userid。 The problem was that in IE and FF I wasn't logged in, so the $userid was empty and the php-page couldn't run so no output. 问题是在IE和FF中我没有登录,因此$ userid为空,并且php页无法运行,因此没有输出。 When I logged in, everything works fine ... 登录后,一切正常...

/me feels stupid

Thx for the help anyway ! 无论如何,谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM