i have the file 1.html:
The code from a1.php isCode:..... <script src="/libs/jquery-1.3.1.min.js" type="text/javascript"></script> <script type="text/javascript"> var url0='{$url0}'; var url1='{$url1}'; var url2='{$url2}'; var url3='{$url3}'; var OPEN_ON = false; openurls= function(){ if(confirm('Opens all?') && OPEN_ON == false){ OPEN_ON = true; $.ajax({ type: "POST", url: "a1.php", data: { url0: url0, url1: url1, url2: url2, url3: url3 }, contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { window.open(url0); window.open(url1); window.open(url2); window.open(url3); alert(msg); }, error: function(msg) { alert(msg); } }) setTimeout("location.reload(true);",3000) OPEN_ON = false } return false } ........ <strong><br><a href="#" onclick="openurls();return false;">Open all </a></strong>
After you press the link "Open All" write "[object XMLHttpRequest]" (error).Code:<?php $url2=$_POST['url2'] if ($url2=="http://www.yahoo.com"){ $url2="http://google.com"; $return = 'true'; }; $url3=$_POST['url3'] if ($url3=="http://www.yahoo.com"){ $url3="http://google.com"; $return = 'true'; }; ?>
Can anyone help me to send the four variables and after verification of a1.php, to send them back.
I am a novice with AJAX.


Reply With Quote

Bookmarks