JQuery help

S

SAL

Hello,
I'm needing some help with JQuery as I'm brand new to this. I have googled
and googled and the following is the best examples I can come up with. I
have tried using JSON's stringify but an error occurs running out of memory.

I have a gridview with a template field. In the template field there is a
checkbox. I have declared onclick="chkHelp(this);" in the checkbox.

In the javascript chkHelp, I call the following javascript function:
function chkAdd(objRef) {
// objRef is an ASP.NET checkbox who's parent is a gridviewrow who's
parent is a gridview. These
// resolve correctly.
var gvr = objRef.parentNode.parentNode;
var gv = gvr.parentNode;

CallPageMethod("DoCheckbox", success, fail,
"obj", objRef,
"gv", gv,
"gvrow", gvr);
}

In the CallPageMethod javascript function, I do the following:

function CallPageMethod(methodName, onSuccess, onFail) {
var args = '';
var l = arguments.length;

if (l > 3) {
for (var i = 3; i < l - 1; i += 2) {
if (args.length != 0) args += ',';
args += '"' + arguments + '":"' + arguments[i + 1] + '"';
}
}

var loc = window.location.href;
loc = (loc.substr(loc.length - 1, 1) == "/") ? loc +
"OwnerLinkPossEditor.aspx" : loc;

$.ajax({
type: "POST",
url: loc + "/" + methodName,
data: "{" + args + "}", //"{" + args + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: onSuccess,
fail: onFail
});
}

The page method is getting called correctly but the objects that get passed
are strings and I can't convert them to the correct object types.
I have tried removing the quotes around the objects but then the page method
does even get called. Can somebody help me with how to pass the objects
correctly to the page method?

Needing help ASAP as I've been working on this for a bit now. Thanks

SAL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top