In the example below, how can i post data to webservice after clicking login button in asp.net?
$(document).ready(function () {
var username=$("#username").val();
var password=$("#pass").val();
$("#dialog").dialog({
bgiframe: true,
autoOpen: false,
height: 400,
width: 300,
modal: true,
buttons: {
"Cancel": function () {
$(this).dialog("close");
},
"Login":function() {
$.ajax(
{
type:"POST",
dataType:"json",
url:"WebService.asmx/Login",
contentType:"application/json",
data:"{username:'"+username+"',password:'"+password+"'}",
success:function(val)
{
$("#isValid").attr("value",val.d);
}}
);
},
},
});
var isValid = $("#isValid").val();
if (isValid== "false") {
// Display the modal dialog.
$("#dialog").dialog("open");
}
});