php - jQuery capitalizing field names from XML return? -


i'm outputting xml php page , parsing result in jquery:

<?xml version="1.0" encoding="utf-8"?> <response> <row> <webpage_tag_id>2096</webpage_tag_id> <stackpageid>test</stackpageid> </row> <row> <webpage_tag_id>2175</webpage_tag_id> <stackpageid>test</stackpageid> </row> </response> 

when console.log result in jquery, get:

[object, object] 0: object stackpageid: "test" webpage_tag_id: "2096" __proto__: object 1: object stackpageid: "test" webpage_tag_id: "2175" 

great why fields capitalized? problem following code outputs "undefined":

$.each(updatearr, function(index,item) {                 console.log(item.webpage_tag_id); });  

...but returns correct result:

   $.each(updatearr, function(index,item) {                  console.log(item.webpage_tag_id);     });  

has heard of issue this?

this fuunction use parse:

$(xml).find("row").each(function () {             var idx=0;         var name='';         var $currentnode = $(this);         var rowobj = new object();           var nodename = $currentnode.children()[idx].nodename;          while( nodename )          {             rowobj[nodename] = $currentnode.find(nodename).text();              if ($currentnode.children()[idx]) {                  nodename = $currentnode.children()[idx].nodename             } else {                 nodename=false;             }              idx++;         }          arr.push(rowobj);            }); 

$(string) parses string html (using dom apis), browser normalizes uppercase.

you want $.parsexml(xml), returns real xml dom.
want create jquery object around that. ($(xml dom element) fine , not parse html)

http://api.jquery.com/jquery.parsexml/


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -