当我点击登录按钮时。下面的函数将被调用。执行流程直到$ .ajax,但它不会进入$ .ajax。任何人都可以帮助我。
$('#login').click(function() {
var contextroot = "/services/";
var userName = $('#userName').val();
var password = $('#password').val();
alert("insid ::: ");
$.ajax({
url: contextroot+"login",
dataType: 'json',
type: 'GET',
contentType: 'application/json',
data: {
userName:userName,
password:password
},
success: function(data){
sessionStorage.setItem("userName", "sharana");
window.location.href = '/admin/index.html';
return false;
}
});
});
答案 0 :(得分:0)
在单个变量中提供整个contextRoot,如下所示
$('#login').click(function() {
var contextroot = '/services/login';
var userName = $('#userName').val();
var password = $('#password').val();
alert("insid ::: ");
$.ajax({
url: contextroot,
dataType: 'json',
....
...