Hello i have the next code: php side:
<?php
print_r($_POST);
print_r($_GET);
die();
?>
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;
}
And in some part of my html:
<a class="button" onclick="voteAjax('content','up','89');">
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
)
And the other 10% of the time i get:
Array
(
)
Array
(
[rand] => 468905.44804602925
)
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?
Edit: 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...
- 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?
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!