Click here to Skip to main content
15,914,162 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
$.ajax({
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        url: '/demo1.asmx/HelloWorld',
        data: "{}",
        dataType: 'json',
        success: function (r) {
            alert('done');
        },
        error: function (r) {
            alert(r.val());
        }
    });


I wan to call HelloWorld method, it is not working.
or how to call 'HelloWorld' method in Jquery and C#.
Please anybode help me.
Posted
Comments
Azee 10-Oct-13 4:38am    
check the path for web service, is it ok? and where is the web service in your own project?

1 solution

The syntax looks fine. If it's failed, then what error's it giving?

Instead of:
JavaScript
alert(r.val());

Try:
JavaScript
alert(r.statusText);

And see what status it gives. If it gives a 'No Transport' status, then it's a cross-domain posting problem, which can be solved as follows:

http://stackoverflow.com/questions/9160123/no-transport-error-w-jquery-ajax-call-in-ie[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900