samedi 7 mars 2015

Sending input array with jQuery and Ajax

I am trying to send a form field array through my form but am unsuccessfull :-/


I have a hidden field, generated from jQuery, looking like this:



$(".imghidden").html('<input type="hidden" name="pimage[]" value="'+data.imgname+'">');


This is generated for each file uploaded to this post. When I then submit the form I do not get anything through the "pimage" form submission. All other fields return a value?!? Below is the jQuery Ajax I am trying to use:



var $form = $( this ),
category = $form.find( "select[name='category']" ).val(),
newcategory = $form.find( "input[name='newcategory']" ).val(),
title = $form.find( "input[name='title']" ).val(),
subtitle = $form.find( "input[name='subtitle']" ).val(),
content = $form.find( "textarea[name='content']" ).val(),
pimage = $form.find( "input[name='pimage']" ).val()

// Send the data using post
var posting = $.post( "data/mod/projects.php", { createnew: true, cat: category, newcat: newcategory, ti: title, sti: subtitle, con: content, pimg: pimage });


What am I doing wrong. Any help is appreciated.


Thanks in advance :-)


Aucun commentaire:

Enregistrer un commentaire