0
function EmpCode(empCode) {
var queryString = "";
var hasQuerystring = document.URL.indexOf('?');
if (hasQuerystring != -1) {
queryString = document.URL.substring(hasQuerystring + 1, document.URL.length);
if (queryString == 'id=1') {
$.ajax({
type: "POST",
url: "EmployeeBasicInfo.aspx/CheckEmpCode",
data: "{'empCode':" + empCode + "}",// Sending empCode which is a string
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
var errorMsg = (msg.d);
if (errorMsg != 'NA') {
alert(errorMsg);
}
}
});
}
}
}
這裏是我的WebMethod發送一個字符串值將WebMethod
[WebMethod]
public static string CheckEmpCode(string empCode)
{
string empCod = "";
EmployeeFactory empFactory = new EmployeeFactory();
empCod = empFactory.CheckCode(empCode);
return empCod;
}
當我送empCode爲「11479」 0R從阿賈克斯Web方法被調用任何整數。當我發送empcode作爲「C1026」或任何帶字符的字符串,然後webmethod沒有得到調用..
請建議我如何傳遞具有字符串值的empCode。
請重新格式化您的問題。 – 2011-02-07 05:59:39