I have this ajax/jquery code :
var headline = $("input#headline").val();
var subheadline = $("textarea#subheadline").val();
var pics = $("input#pics").val();
var dataString = 'headline='+ headline + '&subheadline=' + subheadline + '&pics=' + pics;
$(".save-notice").hide();
$.ajax({
type: "POST",
url: "web-block/forms/process-001.php",
data: dataString,
success: function() {
$(".save-notice").show();
$(this).parents(".manage-content-wrap").next(".ribbon-content").fadeIn();
}
});
on the other side, I have this HTML form :
<form action="" id="select-block" class="general-form">
<div class="input-wrap">
<input class="clearme" name="Headline" value="<?php echo $Headline;?>" id="headline"/>
</div>
<div class="input-wrap">
<textarea class="clearme" name="Sub-Headline" id="subheadline"><?php echo $SubHeadline;?></textarea>
</div>
<label>Bottom Left Image</label>
<div class="up-mask">
<span class="file-wrapper">
<input type="file" name="Pics" class="photo" id="pics" />
<span class="button">
<span class="default-txt">Upload Photo</span>
</span>
</span>
</div><!-- .up-mask -->
<input type="hidden" name="Key" value="<?php echo $Key;?>"/>
<input type="submit" class="submit-btn" value="SAVE" />
<span class="save-notice">Your changed has been saved!</span>
</form>
as you can see process-001.php is the file which process all variables from HTML form. but I have difficulties to 'catch' $Headline and $SubHeadline submitted by that form, which actually 'manipulates' by Ajax too...
I tried using this code on process-001.php :
$Headline = $_POST['Headline'];
$SubHeadline = $_POST['Sub-Headline'];
but seems that those variables are empty... how to get variables submitted by AJAX correctly?