Reputation: 357
Ive been working on uploading files using ajax, the only one that has worked for me is this plugin called jquery form. Its really simple, and it works but the problem im facing is that it does not show the output.
my process.php file does output a error message or success message(Picture uploaded/ unknown image extension and so on) but these are not being shown. How can i display the script outputs?
Upvotes: 1
Views: 103
Reputation: 100175
There a callback function "success" provided, that is invoked after the response has been returned from the server. Like:
$(document).ready(function() {
var options = {
target: '#output1', // target element(s) to be updated with server response
beforeSubmit: showRequest, // pre-submit callback
success: showResponse // post-submit callback <-- See here
};
// bind form using 'ajaxForm'
$('#myForm1').ajaxForm(options);
});
function showResponse(responseText, statusText, xhr, $form) {
alert(responseText);
}
Ref: jQuery Form Hope it helps
Upvotes: 1