JSON Response Issue |
[eluser]J4CK[/eluser]
I am having an issue with a Control Panel that I've been working on. I have a general account settings page. On this page, the user can perform various functions such as create a new user, change their password, or update their e-mail preferences. The account creation panel works without any issues. The data gets POST, and returns a JSON response. Where I'm having difficult is on the next panel for changing the user's password. The data gets POST, and Firebug gets the appropriate response. However, the Chrome Developer JS console gets nothing back, but the data still gets posted to the database. None of the messages appear where they're supposed to in HTML (i.e. "You have changed your password"). So the function is working properly, if you change your password and refresh the page you get the message from the JSON response. No server or php errors are reported. The problem is the JSON response returned never gets shown. I was getting a headers already sent message, but I can't replicate it (have revised the code numerous times since then). Any help or advice would be appreciated. Thanks! Controller - Code That Works (returns JSON) Code: public function createAccount($data) Controller - Code That Doesn't Work Code: public function changePassword($data) jQuery - Broken AJAX Call Code: $("#changePassword").click(function(){
[eluser]CroNiX[/eluser]
I see that you misspelled "cache" in the jQuery call. Also, what happens if you console.log(data) as the first thing in the ajax success event?
[eluser]J4CK[/eluser]
Hi CroNiX thanks for the typo correction. Nothing is logged if I try console.log(data) Nothing is returned at all, but the function executes, and Firebug registers the POST with the appropriate, but the response fails to come back and execute on the page.
[eluser]CroNiX[/eluser]
Code: private function json_output($data) What's the _display() method?
[eluser]J4CK[/eluser]
Suggestion from this StackOverflow thread: http://stackoverflow.com/questions/12210...5_12210144
[eluser]CroNiX[/eluser]
Just try this and see if you get data back to your jquery: Code: private function json_output($data) |
Welcome Guest, Not a member yet? Register Sign In |