Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling service from Html

i want to call asp.net web service from java script and pass the parameters to it .is there any code sample or demostration that will help me to acheive that?? thanks in advance


1 Answers

JQuery:

function AddLocation(ParentID) {
    $.ajax({
        type: "POST",
        url: "../server.asmx/Save",
        data: "{'ID':'0','ParentID':'" + ParentID + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data) {
            var item = document.createElement('option');
            item.value = data.d.split("$")[0];
            item.text = name;
            //do stuff
        }
    });
}
like image 147
Ali Tarhini Avatar answered Feb 28 '26 06:02

Ali Tarhini