这有什么阿贾克斯(原型)的问题? [英] What is the problem with this ajax(with prototype)?

查看:273
本文介绍了这有什么阿贾克斯(原型)的问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有下一个code: PHP端:

Hello i have the next code: php side:

<?php
print_r($_POST);
print_r($_GET);
die();
?>

在JavaScript的:

In javascript:

voteAjax = function(typez, actionz, idz){
    new Ajax.Request(
        'http://localhost/reporeade/Vote/Ajax/?rand='+Math.random()*500000, 
        {asynchronous:true, 
         evalScripts:true,
         method:'post',
         parameters:'contentType='+typez+'&action='+actionz+'&id='+idz 
        });
    return false; 
}

而在我的HTML的某些部分:

And in some part of my html:

<a class="button" onclick="voteAjax('content','up','89');">

您可以看到即时通讯上运行本地主机...我的问题是,POST某种程度上得到混合有时候,我得到下一个答案90%的时间:

You can see im running on localhost... the problem i have is that the POST somehow gets mixed up SOMETIMES, i get the next answer 90% of the time:

Array
(
    [contentType] => content
    [action] => up
    [id] => 89
)

Array
(
    [rand] => 449701.9597706424
)

和时间,其他10%,我得到:

And the other 10% of the time i get:

Array
(
)

Array
(
    [rand] => 468905.44804602925
)

现在,我已经尝试了一切,改变了计算机,尝试在服务器上使用一个完整的URL(想也许是本地主机的故障),读的地方,使用的 HTTP://本地主机/ reporeade /投票/阿贾克斯/兰特=中的 instade =HTTP://本地主机/ reporeade /投票/阿贾克斯兰特=相对=nofollow> HTTP://本地主机/ reporeade /投票/阿贾克斯兰特= 解决了麻烦,但尝试都和真的不能undertand什么使后迷路....任何想法?

Now, i have tried everything, changed computer, tried on a server with a full url(thinking maybe localhost was the trouble), read somewhere that using http://localhost/reporeade/Vote/Ajax/?rand= instade of http://localhost/reporeade/Vote/Ajax?rand= solved the trouble but tried both and really cant undertand what would make the post get lost.... any ideas?

编辑: 这一切玩好后,我得到它的工作(如它是)在我们的生产服务器,但我们所有的WAMP的instalations将无法正常工作(当然不能像50%的时间)。它为我解决这个问题,所以我们可以继续开发产品的所有Ajax功能,所以真的很重要......

Well after playing with all this, i got it working(like it is) in our production server, but in all of our wamp instalations it will not work(well fail like 50% of the time). Its really important for me to solve this so we can keep on developing all the ajax functionality of the product, so...

  • 在我试图XAMPP,但它不兼容我们的框架
  • 在我试着将在Apache 2.0,而不是2.2 WAMP
  • 在我试图用在httpd.conf和php.ini中
  • 的diferent配置
  • I tried xampp but its not compatible with our framework
  • I tried going to apache 2.0 instead of 2.2 in wamp
  • I tried with diferent configurations of the httpd.conf and php.ini

为什么瓦帕会失败,这样任何想法?

Any ideas of why wamp would fail like this?

更新: 我敢肯定,问题是WAMP安装目录未发送POST正确有些时候,任何帮助,这将导致解决,这将得到正确的答案,赏金!

Update: I'm sure the problem is the wamp instalation that is not sending the POST correctly some times, any help that would lead to solving this will get the correct answer and the bounty!

推荐答案

我也建议你应该通过监控Wireshark的网络流量:

I also suggest you should monitor your network traffic through Wireshark:

  1. 在任一服务器或客户机上启动它。
  2. 开始捕捉你的网络接口。
  3. 当它出​​现故障停止使用AJAX和
  4. 捕获和
  5. 在Wireshark的类型HTTP来帮助你找到所求。
  6. 右键单击并选择跟随TCP流。

如果在采购信息发布的数据显示不出来这件事情与浏览器。你可以(在结合器好像gzip与IE浏览器已经提到过)检查HTTP头可能存在的错误。

If POST data in the request does not show up it's something with the browser. You could check HTTP headers for possible errors (like GZip in conjunction with IE has been mentioned before).

也许你的WAMP的安装使用快速CGI或类似的调用PHP的,所以它不使用的Apache实际的PHP模块?有时,如果没有正确设置这可能会导致这样的错误。如果你并不一定需要它,我建议切换到PHP模块或寻找可能的配置错误。

Maybe your WAMP setup uses Fast-CGI or similar to call PHP, so it is not using the actual PHP module for Apache? Sometimes this can cause such errors if not set up correctly. If you do not necessarily need it I recommend switching to PHP module or look for possible configuration mistakes.

什么WAMP的是它呢? pre配置或定制?

What WAMP is it, anyway? Pre-configured or custom?

这篇关于这有什么阿贾克斯(原型)的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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