labaiss Posted July 22, 2010 Report Share Posted July 22, 2010 Nepieciešams AJAX scripts php faila darbināšanai ar atbildi. Ir kādi varianti? Quote Link to comment Share on other sites More sharing options...
mixis Posted July 22, 2010 Report Share Posted July 22, 2010 hotscripts Quote Link to comment Share on other sites More sharing options...
Uldis Posted July 22, 2010 Report Share Posted July 22, 2010 Lai nav jāpārkopē teksti - http://www.techmynd.com/load-external-file-data-with-ajax/ Quote Link to comment Share on other sites More sharing options...
Uldis Posted July 22, 2010 Report Share Posted July 22, 2010 Tā kā tā lapa mazliet bremzējas, tad iekopēju skriptu, lai nav jāgaida 2 min :) Ceru, ka tas ir tas, ko meklēji INDEX.HTML <html> <head> <title>AJAX Tutorial</title><script language="JavaScript" src="ajax.js"></script> <script language="JavaScript"> function doSomethingWithData(str) { document.getElementById('MyID').innerHTML = str; } </script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css"> <!-- body,td,th { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #666666; } --> </style></head> <body> <b>AJAX Tutorial: Example 1</b><br /> This example shows how to dynamically retrieve data from a JavaScript file.<br /><br /> <a href="#" onClick="loadScript('Data1.js')">Data File 1</a><br /> <a href="#" onClick="loadScript('Data2.js')">Data File 2</a><br /> <a href="#" onClick="loadScript('Data3.js')">Data File 3</a><br /> <br /> <div id="MyID"> </div> </body> </html> AJAX.JS function loadScript(scriptURL) { var newScript = document.createElement("script"); newScript.src = scriptURL; document.body.appendChild(newScript); } function loadData(URL) { // Create the XML request xmlReq = null; if(window.XMLHttpRequest) xmlReq = new XMLHttpRequest(); else if(window.ActiveXObject) xmlReq = new ActiveXObject("Microsoft.XMLHTTP"); if(xmlReq==null) return; // Failed to create the request // Anonymous function to handle changed request states xmlReq.onreadystatechange = function() { switch(xmlReq.readyState) { case 0: // Uninitialized break; case 1: // Loading break; case 2: // Loaded break; case 3: // Interactive break; case 4: // Done! // Retrieve the data between the <quote> tags doSomethingWithData(xmlReq.responseXML.getElementsByTagName('quote')[0].firstChild.data); break; default: break; } } // Make the request xmlReq.open ('GET', URL, true); xmlReq.send (null); } Data1.JS doSomethingWithData("Text Data 1 - Hello World"); Data2.JS doSomethingWithData("Text Data 2- Happy Ajaxing"); Data3.JS doSomethingWithData("Data 3 - Example"); Quote Link to comment Share on other sites More sharing options...
labaiss Posted July 22, 2010 Author Report Share Posted July 22, 2010 Paaldies - kaut ko samontēšu Quote Link to comment Share on other sites More sharing options...
Леший Posted July 22, 2010 Report Share Posted July 22, 2010 Lai būtu saprotamāk, tomēr ieteicams izmantot kādu JS FW, piemēram, jQuery. Developēt daudz vieglāk, un nav jādomā, ka kaut kāds specifisks IE build ar tavu kodu neies. Tas, ko Uldis iepeistoja, der pašizglītības nolukos, lai saprastu, kā darbojās AJAX. Quote Link to comment Share on other sites More sharing options...
labaiss Posted July 22, 2010 Author Report Share Posted July 22, 2010 Lai būtu saprotamāk, tomēr ieteicams izmantot kādu JS FW, piemēram, jQuery. Developēt daudz vieglāk, un nav jādomā, ka kaut kāds specifisks IE build ar tavu kodu neies. Tas, ko Uldis iepeistoja, der pašizglītības nolukos, lai saprastu, kā darbojās AJAX. Jā, pie tā arī paliku - JQUERY Quote Link to comment Share on other sites More sharing options...
labaiss Posted July 22, 2010 Author Report Share Posted July 22, 2010 re kur pat atradu jau domu gatavu: SIMPLE AJAX WITH JQUERY Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.