ajax trouble :(
ajax trouble :(
So I have a little form that allows you to add a new category to the site using ajax. When I actually try and use this code below it just alerts an error. When I manually type in the url that it's posting it returns the proper XML document that I need. But if i use the ajax the error function alerts. Any ideas why?
-
$(document).ready(function(){
$("#cat_btn").click(function() {
var cat = $("input[@name=new_category]").val();
if(cat != "") {
$.ajax({
type: "POST",
url: "process.php",
data: "action=blogcategories&cat="+cat+"&sub=add&ajax=true",
dataType: "xml",
success: function(xml){
alert( "Data Saved: " + xml );
},
error: function(err) {
alert("Error: "+err);
}
});
}
});
});