forumnz Posted February 16, 2008 Share Posted February 16, 2008 Im having real trouble with this. Can someone please help me? I am trying to insert a new record into a db using AJAX., How can I do it? Thanks, Sam. Quote Link to comment Share on other sites More sharing options...
djbuddhi Posted February 18, 2008 Share Posted February 18, 2008 really easy function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser broke..!Pls Try Again ...!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('divAdd_PromotionsInfo'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var csc = document.getElementById("txtboxname").value; var queryString = "?pcsc="+csc+; ajaxRequest.open("GET", "test.php" + queryString, true); ajaxRequest.send(null); } } in the test.php page write the insert qurey and get the message to div tag and display the result 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.