XMLhttpRequest > PHP > XMLhttpRequest -
I have another question XMLhttpRequests are bothering me Now everything is in the database but I need this page that I Load your page to the brick page or reload it. XHR is triggered in a javascript file that triggers PHP Script. PHP Script Access MySQL Database But how can I get back records in my JavaScript for page updates? I can not understand it
First my synchronous XMLhttpRequest:
retrieve the function RowsDB () {if (window.XMLHttpRequest) {// code for IE7 +, Firefox, Chrome, Opera , Safari xmlhttp = new XMLHttpRequest (); } Else {// code for IE6, IE5 xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP"); } XMLhttp.open ("GET", "retrieveRowData.php", incorrect); Xmlhttp.send (zero); Return xmlhttp.responseText; }
Then my PHP-script:
& lt ;? Php $ con = mysql_connect ("localhost", "root", "**** *********"); If (! $ Con) {dead ('Could not connect:' Mysql_error ()); } Mysql_select_db ("sadb", $ conn); $ Data = "Choose user order by ASC by selectors"; If (! Mysql_query ($ data, $ conn)) (die ('error:'. Mysql_error ());} and {$ dbrecords = mysql_query ($ data, $ conn);} $ Rowdata = mysql_fetch_array ($ dbrecords); Return $ rowdata; mysql_close ($ thief);? & Gt;
What am I missing here? Has anyone got a clue?
Your code is not so wrong
In your PHP file, you must output it somehow. , It's just sending blank documents to JavaScript, so you will need to code On the other hand, in JS, you will need to take a response and update the page in some way. Currently, you are returning it again. I suggest you Go through Uc Ajax Tutorials, and consider using a framework such as lifting heavy loads for you. You also want to read something on this subject, because you have some fundamental misconceptions. Instead of returning $ rowdata
echo
Generally, when using many objects to return to JavaScript, this is a good format. Check.
Comments
Post a Comment