reading javascript alert value from xml -


I have a JavaScript function code where I want to alert.

  function msg (x, y) {tempstr = x.value if (tempstr.length & gt; y) {warning (c_cknowledgmentText); X.value = tempstr.substring (0, Y); }}  

Now I have an XML with the format:

   

I want JavaScript code so that the message shown in the above alert can be read from the XML key name "c_cknowledgmentText".

I hope this is clear about me problem.

Actually, though you want to use XMLHttpRequest, you try to do with tempstr Are, though.

  function msg (x, y) {tempstr = x.value; If (tempstr.length & gt; y) {var req = New XMLHttpRequest (); Req.open ('GET', '/file.xml', is true); Req.onreadystatechange = function (aEvt) {if (req.readyState == 4) {if (req.status == 200) {var keys = req.responseXML.getElementsByTagName ("key"); (Var i = 0; i & lt; keys.length; i ++) {var key = key [i]; If (key.getAttribute ("name") == "c_cknowledgmentText") {warning (key.textContent); break; }} Other Warnings ("Error loading page \ n"); }}; Req.send (zero); X.value = tempstr.substring (0, Y); }}  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -