>>> public CustomerEntity GetCustomerByCustomerNumber(string customerNumber) >>> { >>> // Instantiate the RunSheet business object >>> Customer oCustomer = new Customer(); >>> >>> return oCustomer.GetCustomerByCustomerNumber(customerNumber); >>>}>>>
This XML file does not appear to have any style information associated with it. The document tree is shown below. >>><CustomerEntity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://servername//xmlwebservices/"> >>><are_name>San Juan</are_name> >>><cus_addr1>175 El Socorro Mn Rd</cus_addr1> >>><cus_arefk>bf5d7cb4-1d72-4a5d-a279-de5b056a7205</cus_arefk> >>><cus_bxtfk>10</cus_bxtfk> >>><cus_cashonly>false</cus_cashonly> >>><cus_cntfk>e3779ef3-79ab-4a85-91a9-d38117ce7f99</cus_cntfk> >>><cus_company>Frank Cazabon</cus_company> >>><cus_credit>false</cus_credit> >>><cus_customs>false</cus_customs> >>><cus_servicefee>true</cus_servicefee> >>><cus_cutfk>1</cus_cutfk> >>><cus_firstname>Frank</cus_firstname> >>><cus_heathrow>false</cus_heathrow> >>><cus_hold>false</cus_hold> >>><cus_insurance>false</cus_insurance> >>><cus_issue>1999-03-29T00:00:00</cus_issue> >>><cus_lastname>Cazabon</cus_lastname> >>><cus_maifk xsi:nil="true"/> >>><cus_miami>true</cus_miami> >>><cus_number>0001</cus_number> >>><cus_PK>17d0638b-aebf-4d0b-b202-2a4abae0827c</cus_PK> >>><cus_renewal>2014-03-29T00:00:00</cus_renewal> >>><cus_rtefk>d1a8b4e4-2291-4d8a-95fc-2646b62088e1</cus_rtefk> >>><cus_stafk>1</cus_stafk> >>><cus_zipfk>6cdb7bdf-9d9b-4441-b884-54921d1cac46</cus_zipfk> >>></CustomerEntity>>>>
public string GetCustomerByCustomerNumber(string customerNumber) >>> { >>> // Instantiate the RunSheet business object >>> Customer oCustomer = new Customer(); >>> >>> string json = JsonConvert.SerializeObject(oCustomer.GetCustomerByCustomerNumber(customerNumber), Formatting.Indented); >>> return json; >>>}>>>
This XML file does not appear to have any style information associated with it. The document tree is shown below. >>><string xmlns="http://servername//xmlwebservices/">{ "$id": "1", "EntityKey": null }</string>>>>
function taskCountChanged() { > var count = $(taskPage).find( '#tblTasks tbody tr').length; > $('footer').find('#taskCount').text(count); > > $.getJSON( "http://localhost:54632/RunSheet%20Web%20Service/RunSheetWS.asmx?op=GetCustomerByCustomerNumber", function( data ) { > var items = []; > $.each( data, function( key, val ) { > items.push( "<li id='" + key + "'>" + val + "</li>" ); > }); > > $( "<ul/>", { > "class": "my-new-list", > html: items.join( "" ) > }).appendTo( "body" ); > }); > }>
http://localhost:54632/RunSheet%20Web%20Service/RunSheetWS.asmx/GetCustomerByCustomerNumberAsmx pages by default require a post. Use the following javascript:
$.ajax({ url: "http://localhost:54632/RunSheet%20Web%20Service/RunSheetWS.asmx/GetCustomerByCustomerNumber", type: "POST", contentType: "application/json; charset=utf-8", dataType:"json", data: { customerNumber: YourCustomerNumberHere}, success: function (data) { // Your function to show the data } });You may want to review this page for more information: http://weblogs.asp.net/scottgu/archive/2007/04/04/json-hijacking-and-how-asp-net-ajax-1-0-mitigates-these-attacks.aspx. You may also want to look into using WebAPI (http://www.asp.net/web-api) in place of the asmx page.