I am trying to do AJAX and need to know why this code does not run a complete or warning error message. I'm in Mozilla Firefox 20.0.1
NOTE
This IS code updates the database (I have a select statement that reads the exact record that checks for its update). I'm just not sure why I cannot get a warning when the answer has completed.
I have these GLOBAL (at the top of the javascript page) declared variables.
var AjaxEnginePage; var ClientInfoPage; var XMLHTTP; AjaxEnginePage = "AjaxEngine.aspx"; ClientInfoPage="getClientInfo.aspx";
Create a connection.
//Creating and setting the instance of appropriate XMLHTTP Request object to a "XmlHttp" variable function CreateXMLHTTP() { try { XMLHTTP = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { XMLHTTP = new ActiveXObject("Microsoft.XMLHTTP"); } catch(oc) { XMLHTTP = null; } } //Creating object in Mozilla and Safari if(!XMLHTTP && typeof XMLHttpRequest != "undefined") { XMLHTTP = new XMLHttpRequest(); } }
Link Binding:
function btnUpdateMe_OnClick() { var me = encodeURIComponent(document.getElementById("MeTextBox").value);
Change handle status
function handleStateChange(me) { switch (XMLHTTP.readyState) { case 0: // UNINITIALIZED case 1: // LOADING case 2: // LOADED case 3: // INTERACTIVE break; case 4: // COMPLETED alert("Success"); break; default: alert("error"); }
I can provide more code if necessary. :( thanks.
source share