I'm trying to build a AJAX function which generates a slug from a title text automatically similer to WordPress. I need to take the title make a AJAX call to the PHP Script which will return the slug back but I'm having issues with getting the Jquery to work at the moment.
I keep getting a error for reponse.get.getElementsByTagName is not a function but not sure why.
Any help?
Code JavaScript://Generate Slug $('#news_title').bind('blur', function() { $.post("news.php", { action: "generateSlug", id: $(this).attr('rel'), term: $('#news_title').val() }, function(response) { if (response = (response.getElementsByTagName('response').length==1) ? response.getElementsByTagName('response')[0] : false) { if (response.getAttribute('status')=='failed') { alert('Not Worked'); } else if (response.getAttribute('status')=='success') { alert('Worked'); } } }, "text"); return false; });



Reply With Quote



Bookmarks