Katrina peterson
Katrina peterson

Reputation: 1

ajax(xmlhttprequest)to string?

I am making an ajax call using webservice url, which gives me data. basicaly that url in browser looks like xml as it is xmlhttprequest. I am able to print the data when there is only set of entry for e.g. for single entry its working:

Upvotes: 0

Views: 237

Answers (1)

Andrew Whitaker
Andrew Whitaker

Reputation: 126042

You could use .each():

$xml.find("Coupon").each(function() {
    var id = $(this).find("CouponID").text(),
        rewardItem = $(this).find("RewardItem").text();

    alert(id);
    alert(rewardItem);
});

Basically, it's iterating over each Coupon element and finding the CouponID and RewardItem elements inside.

Upvotes: 1

Related Questions