Using JQuery for reading XML through javascript -


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

  function msgalert (x, y) {tempstr = x.value if (tempstr.length & gt; y) {warning (c_cknowledgmentationtext); 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_ acknowledgmentText".

I'm trying with the code below, but unable to solve the problem, would you please

  & lt; Script language = "javascript" type = "text / javascript" & gt; Function msgalert (x, y) {tempstr = x.value if (tempstr.length & gt; y) {$ (document) .ready (function () {$ .ajax ({type: "GET", url: ". ./ (/) "(" key ") each (function () {var title = $ (this) .find ('name)') .text (););});}}); }); }} & Lt; / Script & gt;  

Something where I need to modify the above function so that I can give it a warning value through XML.

I really can not understand what you are trying to do, but this code is wrong :

  var title = $ (this). ('Name') text ();;  

At that point, this current & lt; Key & gt; To get the value of the name attribute of this element, you must do this:

  var is the element through which you are looping = $ (This) .attr ('name');  

and then to get content of this element, you will do this:

  var title = $ (this) . Text ();  

In response to your comment, I think you want it:

  var title = $ (this) .find ('key [name = C_cknowledgmentText] ') .text (); Warning (title);  

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? -