[jQuery] newbie question about accessing form variables in an .ajax post
So i have a simple text field and some jquery to post it to a server
side php script.
Everything works fine (writing to db etc...) except that I (obviously)
want to send the data in the sub_menu form in the data element of
the .ajax call. I've tried assigning id's and accessing those id's
etc... I'm obviously just missing something basic. How do I assign
this?
It looks like this:
$('#submit_sub_menu_add').click(function(){
$.ajax({
type: "POST",
url: "/Menu/add-sub-menu/",
data: "sub_menu_headline=John&parent_id=750",
success: function(msg){
alert("this came back");
//alert( "Data Saved: " + msg );
}
});
});
with 'form' being (no actual form tags):
<input type='text' name='sub_menu' value='sub_menu' /><span
id='submit_sub_menu_add'>submit</span>
thanks,
jonathan