jquery ajax request |
[eluser]Unknown[/eluser]
Hi all!!! I am creating a registration form, which will allow users to select their username. So I have an ajax request which is supposed to return true or false if the name is available. For some reason what is being returned is the HTML of a page. form code Code: <div id="registerFormContainer"> JS function Code: function verifyUsername(){ Controller function Code: function verify_name(){ Model Code: function verify_name_availability($reqName){
[eluser]danmontgomery[/eluser]
Code: return 'lawd have mercy'; You can't return values in an ajax call, you have to output them
[eluser]Unknown[/eluser]
Thanks for the response noctrum... That line isn't actually in the final draft. In my trying to figure out the issue myself, I tried a lot of things. That line was initially commented out, but in formatting the code to post into the forum i removed the commenting by accident. I have since removed it. Could you see if anything else seems wrong?
[eluser]danmontgomery[/eluser]
Not without more information... What page is being returned? Is it a 404 page, or a valid controller/method response? Using firebug, grab the URL that it's actually requesting. Is it what you expect? What do you see when you go to that url in your browser?
[eluser]GreatSlovakia[/eluser]
Dunno what you are doing incorrectly with this code, although I would advise you to add an else statement to the controller function and next look into the developer tools of your browser what the ajax request is returning. Alternatively you could use http://ellislab.com/forums/viewthread/191441/ to directly call your model from javascript. (disclaimer, that's written by me ![]() |
Welcome Guest, Not a member yet? Register Sign In |