JQuery AJAX cryptic bug requires more arguments

JQuery ajax user to register users. I use the almost exact code below to do similar things throughout my site, but for some reason the code below throws this error in Firebug.

Error:

uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js :: add :: line 5437" data: no]

Call:

 lzaUserAPI.doAUserSignup(signupUsername, signupPassword, signupEmail, signupFullname, signupCompanyName, signupWebsite, signupPhone, lzaSigninup.onAUserSignedUp); 

Ajax Function:

 doAUserSignup : function(username, password, email, fullname, companyname, website, phone, callback){ // Add to server var paras = {cmd : 'doAUserSignup', us: username, ps: password, em: email, flnm: fullname, cpnm: companyname, wbst: website, phne: phone}; $.ajax({ url: lzaUserAPI.m_url, dataType: "json", data: paras, success: function(ret){callback(ret)} }); }, 

Callback:

 onAUserSignedUp : function (ret) { alert ('yea!!!'); //Todo: log them in } 

Any ideas? Thanks in advance!

+4
source share
3 answers

The problem is somewhere in the code that transforms the data object. Since we cannot see all the code where it is not clear exactly. Here is what you do, change the code as follows:

 // var paras = {cmd : 'doAUserSignup', us: username, ps: password, em: email, flnm: fullname, cpnm: companyname, wbst: website, phne: phone}; var paras = {cmd : 'doAUserSignup'}; 

See if this works if it starts adding items until you find the problem.

+9
source

I don't think this will fix anything, but you should change:

 success: function(ret){callback(ret)} 

to

 success: callback 

Because you already have a callback as a pointer. There is no reason to force him to wrap others.

+3
source

Just a head to anyone who encounters this ... I looked for the reason why this happened 2 hours before realizing that I forgot to add

 .attr('value') 

In each and every meaning: (

The value I made:

 user_name: $('div#registrationForm').find('input#user_name'), first_name: $('div#registrationForm').find('input#first_name'), 

Instead of this:

 user_name: $('div#registrationForm').find('input#user_name').attr('value'), first_name: $('div#registrationForm').find('input#first_name').attr('value'), 

Hope this helps save someone time!
Regards, Sagive

0
source

All Articles