I have this function in jquery which has the result array and how can I get this result array to C# code. Can anyone help me regarding this.
function generateData() {
var result = $( #accordion ).sortable( toArray );
}
I have this function in jquery which has the result array and how can I get this result array to C# code. Can anyone help me regarding this.
function generateData() {
var result = $( #accordion ).sortable( toArray );
}
你们可以通过从文字上调来的网络方法,来同步地这样做,这样你就能够适当地界定一种网络方法,然后按照预期,要求和处理数据和潜在的回报价值。 例如:
界定网络方法:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static string HandleData(object[] data)
{
//handle data
return string.Empty;
}
界定可再使用的jQuery书写方法,处理网络电话:
function ExecutePageMethod(page, fn, paramArray, successFn, errorFn) {
var paramList = ;
if (paramArray.length > 0) {
for (var i = 0; i < paramArray.length; i += 2) {
if (paramList.length > 0) paramList += , ;
paramList += " + paramArray[i] + ":" + paramArray[i + 1] + " ;
}
}
paramList = { + paramList + } ;
$.ajax({
type: "POST",
url: page + "/" + fn,
contentType: "application/json; charset=utf-8",
data: paramList,
dataType: "json",
success: successFn,
error: errorFn
});
}
当然,呼吁本身:
ExecutePageMethod("Default.aspx", "HandleData",
["data", result], successCallback, failureCallback);
自然,我们现在需要确保有我们的反馈方法:
function successCallback(result) {
var parsedResult = jQuery.parseJSON(result.d);
}
function failureCallback(result) {
}
利用隐蔽区储存结果。
<asp:HiddenField id="hfResult" runat="server" />
J Query
$( hfResult ).val(result);
C#
String result = hfResult.Value;
注 实地只能进行扼杀,因此,你可能需要使用某种掩饰器来没收你的阵列物体。
In my webpages I have references to js and images as such: "../../Content/Images/"Filename" In my code if I reference a file as above, it doesnt work so i have to write: "c:/miscfiles/"filename" 1-...
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...
I m looking for best practices here. Sorry. I know it s subjective, but there are a lot of smart people here, so there ought to be some "very good" ways of doing this. I have a custom object called ...
I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...
i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...
For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!