【发布时间】:2015-06-24 04:17:55
【问题描述】:
我有一个计时脚本,在这个脚本的最后我希望通过 ajax 运行一个代码,它的结果应该出现在弹出框中。 这是我的代码
var ticker = function() {
counter--;
var t = (counter / 60) | 0; // it is round off
digits.eq(0).text(t);
t = ((counter % 60) / 10) | 0;
digits.eq(2).text(t);
t = (counter % 60) % 10;
digits.eq(3).text(t);
if (!counter) {
clearInterval(timer);
// alert('Time out !');
$.ajax({
type:'post',
url:'timewalkaway.php',
dataType: 'json',
data:{txt:txtbox,hidden:hiddenTxt},
cache:false,
success: function(returndataaa){
console.log(returndataaa)
if (returndataaa[2] == 'No deal')
//$('#proddisplay').text("Sorry! We both tried hard, but could not reach a deal. You can buy on our last offer deal.");
$('#proddisplay').load('reply1.php');
if (returndataaa[2] == 'priority_one')
//$('#proddisplay').text("You made us an offer we cannot refuse. Click Buy Now We do not offer this price to everyone");
$('#proddisplay').load('reply2.php');
if (returndataaa[2] == 'priority_two')
//$('#proddisplay').text("This offer is slightly low, we can give this product if you pay us through Cash On delivery!!");
$('#proddisplay').load('reply3.php');
if (returndataaa[2] == 'priority_two1')
//$('#proddisplay').text("This offer is slightly low, we can give this product if you pay us through Cash On delivery!!");
$(proddisplay).load('reply3.php');
if (returndataaa[2] == 'priority_three1')
//$('#proddisplay').text("Hey! this is a low offer, we can accept this offer if you agree to write a review for this product");
$('#proddisplay').load('reply4.php');
if (returndataaa[2] == 'priority_three2')
//$('#proddisplay').text("Hey! this is a low offer we can accept this offer if you can share about us on facebook using the link after checkout, we wil give the amt after the checkout.");
$('#proddisplay').load('reply5.php');
if (returndataaa[2] == 'priority_four1')
//$('#proddisplay').text("A low offer indeed! If you write us a product review and give us cash on delivery we can take this offer");
$('#proddisplay').load('reply6.php');
if (returndataaa[2] == 'priority_four2')
//$('#proddisplay').text("A low offer indeed! If you share this on facebook and give cash on delivery we can take this offer");
$('#proddisplay').load('reply7.php');
}
});
resetView();
}
};
我检查了控制台我在console.log(returndataaa) 中得到了结果在里面显示结果
【问题讨论】:
-
尽可能显示完整代码。
标签: javascript jquery ajax