We help IT Professionals succeed at work.
Get Started

jquery, xml

ITsolutionWizard
on
228 Views
Last Modified: 2015-05-05
I have a webservice result below.

and I am trying to get value of <NetPrice></NetPrice> in jquery.

How can I do that? I have below jquery codes to get start.


<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">&lt;Status&gt;Completed&lt;/Status&gt;&lt;CustomerNumber&gt;335281&lt;/CustomerNumber&gt;&lt;OrderDate&gt;04-15-15&lt;/OrderDate&gt;&lt;OrderDetail&gt;&lt;Item id="0"&gt;&lt;Model&gt;&lt;![CDATA[AAS3602I]]&gt;&lt;/Model&gt;&lt;Quantity&gt;1&lt;/Quantity&gt;&lt;DealerPrice&gt;226.000&lt;/DealerPrice&gt;&lt;NetPrice&gt;226.000&lt;/NetPrice&gt;&lt;/Item&gt;&lt;/OrderDetail&gt;</string>

Open in new window


<script type="text/javascript">
    function unescapeHTML(escapedHTML) {
            return escapedHTML.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');
        } 
    function GetNetPriceByOrders() {
        var companyID = "066"
        var customerNo = "335281";
        var modelNo = "[AAS3602I]";
        var qty = "[1]";
        var orderDate = "1";
        var repNo = "SA7";
        var GetNetPriceJSon = "http://clientaccesstest.usa.com/wcf/orders/RestService/ProQuoteService/GetNetPrice";
        $(document).ready(function () {
            $.ajax({
                crossDomain: true,
                cache: false,
                type: "GET",
                async: false,
                dataType: "text", // "text/plain", //response format
                contentType: "text/plain", //request format                       
                url: GetNetPriceJSon + "(" + companyID + "," + customerNo + "," + modelNo + "," + qty + "," + orderDate + "," + repNo + ")",

                success: function (data) {
                     alert(data)

                },
                error: function (xhr, status, error) {
                    alert(xhr.responseText + " : error GetNetPriceJson from Orders");
                }
            });
        });
    }
</script>

Open in new window

Comment
Watch Question
Owner (Aidellio)
CERTIFIED EXPERT
Most Valuable Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE