Question: url is undefined in ajax?
Answer: You're telling the Ajax request to expect HTML to be returned and not JSON, so returl will quite literally be a string value and thus returl. url will be undefined. Change your datatype to json instead. Found this on http://api.jquery.com/jquery.ajax/#jQuery-ajax-settings.