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. Link to comment https://forums.phpfreaks.com/topic/91449-insert-record-into-database/ 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 Link to comment https://forums.phpfreaks.com/topic/91449-insert-record-into-database/#findComment-469262 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.