first step
The page needs to reference this js
second step
var loginJs = {
//登录
goLogin: function () {
var _userinfo = { name: "夏小沫", pwd: "123" };
var _addinfo = { Country: "北京", Street: "上地三街" };
Common.MyAjax.GetJsonByPost("/myinfo/GetInfo", JSON.stringify({ userinfo: _userinfo, addinfo: _addinfo }), false, function (data) {
try {
alert(data);
} catch (e) {
alert(e.message);
}
});
},
}
This is the method to call common.js, the method is very simple, common.js is equivalent to a class, you can call it directly.