"SyntaxError: Failed to execute 'open' on 'XMLHttpRequest': Invalid URL" 在F12谷歌调试里报这个,我的URL我拿出来粘到浏览器里回车 可以进我的后台啊。
以下是我的ajax语句。
$.ajax({
method:"post",
type:"POST",
url: ":8080/skproject/SysLocationInfoController/testEntityData.json",
data:{"sysUserInfo.user_nm":username, "sysUserInfo.pwd":password},
datatype:"json",
success:function(data){
alert("成功了");
},
error:function(error){
alert(error);
}
});
问题解决方案:你的URL地址前面一定要加上HTTP:// 不加就会报错!!!!
有的同学也可能是跨域问题!
跨域问题请猛戳链接
ajax 跨域解决方案