fateme1
یک شنبه 18 دی 1390, 16:01 عصر
سلام این کد jqueryقراره مقدار text رو به وب متد ودر نهایت پایگاه داده بفرسته و یه تعداد رکورد بر گردونه ولی خطای undefind xml http requestمیده.
کسی میدونه چرا؟
آیا باید تنظیمات خاصی روی پروژم اعمال کنم؟
این کدjquery
$(function () {
$('#search').click(function () {
var family = $('#txtFamily')
var Condition = '';
if (family.val().length > 0)
Condition ='family=' + family.val();
text='{Condition:"' + Condition + '"}';
$.ajax({
type:'POST',
url:home.aspx/Request_GetAll' (http://barnamenevis.org/home.aspx/Request_GetAll'),
data: text,
contentType:'application/Json; charset=utf-8',
dataType:'Json',
beforeSend: function () {
alert("begin");
},
success:function (msg) {
alert("success" + msg);
$("#test").load("htmes/Request.htm");
},
error: function (e) {
alert("error" + e.d);
},
complete: function (c) {
alert("complete");
}
});
});
});
اینم وب متدم
[WebMethod]
publicstaticstring Request_GetAll(string family)
{
RequestList list = newRequestList();
list =
Request_DB.Request_get(family);
StringBuilder sb = newStringBuilder();
foreach (var item in list)
{
sb.Append(
"<tr ItemID='" + item.ItemId + "'>");
sb.Append(
"<td><img src='../Image/delete.png' ItemID='" + item.ItemId + "'/></td>");
sb.Append(
"<td><img src='../Image/edit.png' ItemID='" + item.ItemId + "'/></td>");
sb.Append(
"<td>" + item.name + "</td>");
sb.Append(
"<td>" + item.mobile + "</td>");
sb.Append(
"<td>" + item.NameCity + "</td>");
}
return sb.ToString();
}
کسی میدونه چرا؟
آیا باید تنظیمات خاصی روی پروژم اعمال کنم؟
این کدjquery
$(function () {
$('#search').click(function () {
var family = $('#txtFamily')
var Condition = '';
if (family.val().length > 0)
Condition ='family=' + family.val();
text='{Condition:"' + Condition + '"}';
$.ajax({
type:'POST',
url:home.aspx/Request_GetAll' (http://barnamenevis.org/home.aspx/Request_GetAll'),
data: text,
contentType:'application/Json; charset=utf-8',
dataType:'Json',
beforeSend: function () {
alert("begin");
},
success:function (msg) {
alert("success" + msg);
$("#test").load("htmes/Request.htm");
},
error: function (e) {
alert("error" + e.d);
},
complete: function (c) {
alert("complete");
}
});
});
});
اینم وب متدم
[WebMethod]
publicstaticstring Request_GetAll(string family)
{
RequestList list = newRequestList();
list =
Request_DB.Request_get(family);
StringBuilder sb = newStringBuilder();
foreach (var item in list)
{
sb.Append(
"<tr ItemID='" + item.ItemId + "'>");
sb.Append(
"<td><img src='../Image/delete.png' ItemID='" + item.ItemId + "'/></td>");
sb.Append(
"<td><img src='../Image/edit.png' ItemID='" + item.ItemId + "'/></td>");
sb.Append(
"<td>" + item.name + "</td>");
sb.Append(
"<td>" + item.mobile + "</td>");
sb.Append(
"<td>" + item.NameCity + "</td>");
}
return sb.ToString();
}