jQuery ajax call to proxy... Only works the first time -


i'm doing few cross-domain ajax calls, using local proxy script wrote in php. javascript code ajax calls (a simplified version) below:

<script src="jquery/jquery-1.10.2.min.js"></script>  <script language="javascript"> function link1 () {     $.ajax ({url:"proxy.php", data:{url:"http://www.microsoft.com/"}})         .done (function (h) { $("#responsebody").html(h); })         .fail (function () { alert ("ajax failed..."); }); } function link2 () {     $.ajax ({url:"proxy.php", data:{url:"http://www.yahoo.com/"}})         .done (function (h) { $("#responsebody").html(h); })         .fail (function () { alert ("ajax failed..."); }); } </script>  <a href="javascript:link1();">link 1</a><br> <a href="javascript:link2();">link 2</a><br>  <div id="responsebody"></div> 

so, it's pretty simple in example. have 2 functions, each of performs ajax query proxy script, passing different remote url. , can click on either of links call 1 of functions. no matter 1 click on, works first time. second time click on link (either same link or other one), fails.

i did try removing code in .done handlers displays ajax result, , started working, although not displaying result defeats purpose of doing ajax query. tried replacing references proxy script references 2 different plain html files on server, , worked fine.

does have idea why these queries work first time, , not after that?


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -