I have a form like this:
<form id="cform">
<label>folder name:</label>
<input type="text" name="Folder[name]" />
<input id="cfolder" type="submit" value="create" />
</form>
I want to submit the form in jQuery ajax, so I have code like this:
$.ajax({
type: "POST",
url: "/folder/create",
data: $('#cform').serialize(),
success: function(msg){
//sucess
}
});
this is all easy so far, but now I want to submit an extra dynamic id($id value is available) along with the whole form. how Can I do that? I tried this:
data: $('#cform').serialize()+"&Folder[id]="+$id,
but it didn't work, the server side did not get the id. the tricky part here for me is Folder[name], Folder[id], because the server side recevie the data in php like this:
if(isset($_POST['Folder'])){
//assign data here
}
hope this is clear and thanks for any suggestion.