1. #1
    Sencha User
    Join Date
    Jul 2011
    Location
    Ohio
    Posts
    13
    Vote Rating
    0
    MaximusW is on a distinguished road

      0  

    Default Ajax Request: Parsing the Response Object

    Ajax Request: Parsing the Response Object


    I'm calling a web service using the following Ext.Ajax.request:

    Code:
    Ext.Ajax.request({
         params: {CustomerNumber:customerNumber, SurveyID:surveyId},
         url: 'http://mywebservicesite.com/survey.asmx/surveyInfo',
         success: function(response) {
              console.log(response.responseText);
         },
         error: function(msg) {
              console.log("Error: " + msg);
         }
    })
    The success outputs the following:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <int xmlns="http://mywebservicesite.com/survey.asmx">490</int>
    So my question is how do I grab the value "490" from the response.responseText.

  2. #2
    Sencha User
    Join Date
    Jul 2011
    Location
    Ohio
    Posts
    13
    Vote Rating
    0
    MaximusW is on a distinguished road

      0  

    Default Unless there's an easier way...

    Unless there's an easier way...


    I don't know if this is the best/easiest solution, but here's what I'm using:
    Code:
    parser=new DOMParser();
    xmlDoc=parser.parseFromString(response.responseText, "text/xml");
    x=xmlDoc.getElementsByTagName("int")[0];
    y=x.childNodes[0];
    console.log("Success: " + y.nodeValue);
    I hope this may prove useful for newbies (like me).

  3. #3
    Sencha User
    Join Date
    Jul 2010
    Location
    Switzerland
    Posts
    78
    Vote Rating
    0
    fx-mike is on a distinguished road

      0  

    Default


    You could use Ext.DomQuery, here is an example
    Code:
    Ext.DomQuery.selectNode('int', response.responseXML).textContent

  4. #4
    Sencha User
    Join Date
    Jul 2011
    Location
    Ohio
    Posts
    13
    Vote Rating
    0
    MaximusW is on a distinguished road

      0  

    Default


    Quote Originally Posted by fx-mike View Post
    You could use Ext.DomQuery, here is an example
    Code:
    Ext.DomQuery.selectNode('int', response.responseXML).textContent
    That's exactly what I was looking for. Anytime you can reduce 5 lines of code to 1 line of code it's a good thing.
    Thank you, fx-mike.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi