JQuery function suddenly stopped working with error converting Javascript argument

about a year ago I wrote a JQuery/Javascript script which makes an ajax call to a PHP page to change a user password, and it has been working wonderfully ever since. Earlier today I started getting complaints that the ajax call is no longer working. When I go to submit the password change form I get the following error: > Could not convert JavaScript argument arg 0 [nsIDOMDocumentFragment.appendChild] http://www.site.com/js/jquery-1.4.4.min.js Line 124 Even though this error occurs, the user's password is changed, and the ouput from the PHP is exactly as it should be... a properly formatted json string: {"Authenticated":{"0":"false"},"MessageString":{"0":"Your User Password Was Changed Successfully."},"PasswordChanged":{"0":"true"}} None of the files associated with this project have been changed in several months, and this form gets used at least a few times a day, so I'm not sure why it suddenly stopped working. Here is the script I am running, and I am running it with JQuery 1.4.4: function makePasswordRequest() { email = jQuery("#email").val(); currentPassword = jQuery("#currentPassword").val(); newPassword = jQuery("#newPassword").val(); newPasswordRetype = jQuery("#newPasswordRetype").val(); jQuery.post("../changeUserPassword.php", { email: email, currentPassword: currentPassword, newPassword: newPassword, newPasswordRetype: newPasswordRetype }, function(data){ if(data.PasswordChanged[0] == true || data.PasswordChanged[0] == "true"){ jQuery("#notificationArea").removeClass("failure"); jQuery("#notificationArea").addClass("success"); } else{ jQuery("#notificationArea").removeClass("success"); jQuery("#notificationArea").addClass("failure"); } jQuery("#notificationArea").html(data.MessageString); }, "json"); }; function resetPasswordRequest() { email = jQuery("#email2").val(); jQuery.post("../resetUserPassword.php", { email: email, }, function(data){ if(data.PasswordChanged[0] == true || data.PasswordChanged[0] == "true"){ jQuery("#notificationArea2").removeClass("failure"); jQuery("#notificationArea2").addClass("success"); } else{ jQuery("#notificationArea2").removeClass("success"); jQuery("#notificationArea2").addClass("failure"); } jQuery("#notificationArea2").html(data.MessageString); }, "json"); }; jQuery(document).ready(function(){ jQuery("#passwordChangeForm").submit(function(e){ e.preventDefault(); makePasswordRequest(); }); jQuery("#passwordResetForm").submit(function(e){ e.preventDefault(); resetPasswordRequest(); }); }); I can't figure out what the problem is, especially since this has been working well for the last year. Any help would be greatly appreciated!
Did you update to 1.7 before testing?

以上就是JQuery function suddenly stopped working with error converting Javascript argument的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准