$.post throwing “Illegal invocation “

In your else, you have:

password2 = $('#pass_re_enter');
penname = $('#pen_enter');

Then you have:

{password: password, password2: password2, username: username, pen_name: penname, TN: "TN"}

You are getting Illegal invocation because jQuery is trying to serialize the jQuery object for $.post, and it can’t. It’s probably trying to call a string method, and is passing it a jQuery object as context, thus causing the error.

You need to add .val().

password2 = $('#pass_re_enter').val();
penname = $('#pen_enter').val();

Leave a Comment