using jsonp in asp.net

Eredalera

New Member
I have the following javascript to get some jsonp into my webpage.\[code\] <script type="text/javascript"> function updateSales(sales) { alert(sales); } function handleRefresh() { alert("I'm alive"); var url = "http://172.18.4.8:83/webservice.asmx/ADUsers2?callback=updateSales"; var newScriptElement = document.createElement("script"); newScriptElement.setAttribute("src", url); newScriptElement.setAttribute("id", "jsonp"); var oldScriptElement = document.getElementById("jsonp"); var head = document.getElementsByTagName("head")[0]; if (oldScriptElement == null) { head.appendChild(newScriptElement); } else { head.replaceChild(newScriptElement, oldScriptElement); } } function pageLoad() { setInterval(handleRefresh, 3000); }</script> \[/code\]For some reason I can't get it to work. I know the jsonp that I am getting is correct because I can browse to that url and I get the json format string. When I load the webpage the I'm alive alert comes up fine every 3 seconds but I never get the alert with the webservice string.Any ideas or suggestions?Thank you for the help
 
Back
Top