[jQuery] Problem with jQuery: AJAX interface / ajaxForm plugin file upload combo.
Dear Jquery devs,
I got a slight but complex problem. and I think I need someone
experienced with ajaxForm for it. I use the nifty AJAX interface
( http://www.visionmasterdesigns.com/tutorial-ajax-interface-menu-using-jqueryphp/
), and i'd like to make my CMS (webshop) in this interface.
For this I use Jquery and PHP.
Everything so far has worked out quite good. Only 1 slight problem :
the $_FILES['fileimage'] variable doesn't seem te get posted.
Normal $_POST variables such as $_POST['txtname'] do get posted.
Working code with a link for stuff inside the content:
$('.content a').click(function() {
var content_show = $(this).attr("title");
var id = $(this).attr("id");
$.ajax({
type: "get",url: "includes/admin/mediator.php",data:
"page="+content_show + "&sleep=0" + "&id=" + id,
success: function(html){
$(".content").html(html);
}
});
});
Now with the form:
var options = {
beforeSubmit: showRequest
};
$('#addcategoryform').ajaxForm(options);
function showRequest(formData, jqForm, options) {
var queryString = $.param(formData);
alert(queryString);
$.ajax({
type: "post",
url: "includes/admin/mediator.php",
data: queryString + "&page=procescategory&sleep=1",
success: function(html){
$(".content").html(html);
}
});
return false;
}
For me the problem is obvious, if you look at the "data:" argument,
the file doesn't get put into the arguments.
The normal arguments do get posted through and I can use them in the
procescategory page.
Does anyone know how to post a file manually or a work-around? I
already tried ajaxSubmit, but doesn't seem to work either.