Reputation: 27038
i have a simple ajax post and something is going wrong. here is my code:
<div id="one_hundredContent"></div>
<a href="<?php echo $id; ?>" id="id"></a>
<a href="100" id="one_hundred"><div class="tab6_stats_under1">100</div></a>
and js
$('#one_hundred').live("click", function() {
var votes = $("#one_hundred").attr("href");
var id = $("#id").attr("href");
var dataString = 'id=' + id+ '&votes=' + votes;
$.ajax({
type: "POST",
url: "https://test.com/fileupload.php",
dataType: dataString ,
success: function() {
$('#one_hundredContent').html('success');
}
});
return false;
});
and php
if(isset($_POST['id']) && isset($_POST['votes'])){
$tal = $_POST['id'];
$votes = $_POST['votes'];
echo $tal.' '. $votes;
die;
}
the request goes on OK:
Request URL:https://test.com/fileupload.php
Request Method:POST
Status Code:200 OK
but there is no response data, i don't see my variables being passed on or my success message
any idea on what am i missing?
thanks
Upvotes: 1
Views: 124
Reputation: 28795
Change dataType: dataString
to data: dataString
dataType
is optional, but if set should be either xml
, json
, script
or html
Upvotes: 2