java - Why my gadget is not receiving data? -
i have application on appspot. on personal domain account.
i have put igoogle gadget on igoogle page of gmail account.
i sending ajax request gadget :
$(document).ready(function(){ jquery.ajax({ type: "get", url: "http://searcegadget2.appspot.com/requestservlet", success: function(msg){ alert(msg); if(msg.search('tr') != -1){ id = msg.split('</tr>').length - 1; //alert(id); $('#amounttable').append(msg); difference(); }else if(msg.search('form') != -1){ $('#gadget').css('display', 'none'); document.write(msg); }else if(msg.search('http') != -1){ document.location = msg; $('#amounttable').append(msg); } },error: function(xmlhttprequest, textstatus, errorthrown){ alert("xmlhttprequest: " + xmlhttprequest.responsetext); alert("textstatus : " + textstatus.responsetext); alert("errorthrown : "+ errorthrown); } }); });
there nothing shown in xmlhttprequest & errorthrown alerts. but, there "error" shown in textstatus !
now, link "http://searcegadget2.appspot.com/requestservlet" shown in red , when open "http://searcegadget2.appspot.com/requestservlet" inspect element in mozilla, returns me required data ! how attach gadget ?
my request servlet in java. reference : jquery.ajax()
also, have tested web application. working !
without seeing error message or , error code it's hard tell issue is, post, think it's cross-domain scripting issue. can't xmlhttprequest different domain. (e.g. gmail.com cannot xmlhttprequest searcegadget2.appspot.com without throwing error).
try add access-control-allow-origin header response of controller handles requestservlet endpoint.
for more information of access-control-allow-origin header, see thread:
Comments
Post a Comment