using ajax from the mm_wizard_login.cfm page. Not returning the json
Hello,
I am using coldfusion 11. I inherited an application which uses the mm_wizard_login coldfusion feature for their login functionality. Now i have to implement the change password functionality in this application. So if the user logs in and the application finds that this user is logging in for the first time, it should redirect the user to the change their initial password.
So i decided to use a jquery third party modal plugin.
I have added the jquery plugin functionality in the mm_wizard_login.cfm page. During the authentication process, the scenario where the user needs to change password, the mm_wizard_authenticate.cfc denies the login and redirects them back to mm_wizard_login.cfm page and then the plugin opens up and allows user to type in their new password. After the user clicks the submit, in jquery i am intercepting their submit and i am making an ajax call to another cfc which is accepting the new password and calling a sql server SP to change their password. this cfc method returns json back the ajax but the returning value is not json, it is returning the html for the mm_wizard_login.cfm page itself.
Everything is working, except the ajax call is not returning json.
In chrome dev tools, i went into the network tab and under response tab, It is returning back the html for mm_wizard_login.cfm page. I don't understand this.
Here is my ajax call below:
url: 'testmethod.cfc',
method: 'POST',
dataType: 'json',
data:{
method:'ChangePassword', //Call the method
jsonData: JSON.stringify($(formdata).serializeArray())
}
})
.done (function (d) {
if (d.Result == 'OK')
$("#modal-custom").iziModal('#modal-custom','setTitle', d.message);
$("#modal-custom").iziModal('#modal-custom','close');
else{
changePwd_ErrorHandler(d.message);
}
})
.fail (function (XMLHttpRequest, textStatus, errorThrown) {
changePwd_ErrorHandler(textStatus + '. Please try again');
});
After nothing worked then i just tried a basic ajax call from my mm_wizard_login.cfm page, here it is below:
url: 'testmethod.cfc',
method: 'POST',
dataType: 'json',
data:{
method:'MethodTest', //Call the method
}
})
.done (function (d) {
})
.fail (function (XMLHttpRequest, textStatus, errorThrown) {
alert('Unable to change password. Please try again');
});
This is not working either. It is returning the same thing, not json but the html content of mm_wizard_login.cfm. Please help.
