Hi besides a jquery function, i want to submit the input formfield of #dropdownbox1 with the ajax post too...please take a look:
The function foo.crop will return an object that contains the width, height, and image string + data type:
$.ajax({
type: "post",
url: "process.php",
data: foo.crop(846, 846, 'png')
})
.done(function(data) {
// do stuff after image is saved
alert( "Okay!" );
});
process.php recieving the variables:
if($_SERVER['REQUEST_METHOD'] == "POST") {
$img = str_replace('data:image/'.$_POST['type'].';base64,', '', $_POST['string']);
$img = str_replace(' ', '+', $img);
how can i add the #dropdown value to the data to send it to process.php ?
maybe if it helps, here is the crop function with the returns:
this.crop = function(width, height, type) {
....
return {
width: width,
height: height,
type: type || 'png',
string: canvas.toDataURL("image/" + type || 'png'),
};
};
please help im quiet new to jquery and i need to get this script work!
TRIED THAT:
var data = {
imageData: foo.crop(846, 846, 'png'),
dropdown: $("#dropdownbox1").val()
};
$.ajax({
type: "post",
url: "process.php",
data: data
});
but it didnt work ;(