Reputation: 1344
I just found out this problem, it was because of <a herf=javascript:void(0)>
!
I have the below jQuery code. It is used to get constants and display target video.
$(document).ready(function(){
$.ajax({
..
success:function(html){
$("#searchResultsVideoList").html(html);
}
});
$("[id^='http://gdata.youtube.com/feeds/api/videos/']").live("click",
function(){
presentVideo($(this).attr("id"));
}
);
function presentVideo(videoId) {
var params = 'operation=show_video&videoId=' + videoId;
var filePath = 'show.php';
$.ajax({
url:"cntl.php",
dataType:"html",
cache:false,
success:function(html){
$("#searchResultsVideoColumn").html(html);
},
error:function(XMLResponse){
alert(XMLResponse.responseText);
}
});
}
});
The problem is that the second $.ajax is basically copy from the first $.ajax, but the second $.ajax always gets an error - and it alert nothing! If I replace the first $.ajax by the second $.ajax, it also works!
Upvotes: 0
Views: 2118
Reputation: 989
did you copy that ajax call from somewhere? which editor do you use? sometimes editors mix up charsets if you copied it from somewhere. in that case try to convert the charset to utf8 or whichever you use.
use firefox install firebug press f12 hit refresh
console: there has to be sth. like : "POST http://yourlocalhost:port/yourajax" click on that and there has to be "header post response html/json/(whatever you return)" what does it say?
Upvotes: 0
Reputation: 989
use firebug in firefox to check the ajax call. simply go to console and click on the ajax call. you can see the call and the response. otherwise you could extend your error callback:
error : function(XMLHttpRequest, statusText, errorThrown) {
$('#error').text("");
$('#error').append(statusText);
$('#error').append(" - ");
$('#error').append(XMLHttpRequest.statusText);
$('#error').append(" - ");
$('#error').append(errorThrown);
}
Upvotes: 0
Reputation: 3889
you have used two different control in each of your ajax call, In first it is searchResultsVideoList and in second it is searchResultsVideoColumn. Check are these correct?
Upvotes: 0
Reputation: 76910
Maybe in the second $.ajax call you are not sending the params
var params = 'operation=show_video&videoId=' + videoId;
var filePath = 'show.php';
$.ajax({
url:"cntl.php",
data: params,
dataType:"html",
cache:false,
success:function(html){
$("#searchResultsVideoColumn").html(html);
},
error:function(XMLResponse){
alert(XMLResponse.responseText);
}
});
Upvotes: 1