1

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?

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

That code did not work, but however i edited it a bit using help from normal ajax code and options page from jquery form's website and now it works swift.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.