Retrieving HTTP status code from loaded iframe with Javascript

后端 未结 2 1336
野性不改
野性不改 2020-11-29 06:17

I used the jQuery Form plugin for asynchronous form submission. For forms that contain files, it copies the form to a hidden iframe, submits it, and copies back the iframe\'

2条回答
  •  被撕碎了的回忆
    2020-11-29 07:04

    You can't get page headers by JS, but you can distinguish error from success: Try something like this:

    
    
    
    
    
    

    On server side:

    /*
      file: upload.php
    */
    ';
      if(success)
         print 'window.parent.OnUploadComplete(1,"File uploaded!");';
      else
         print 'window.parent.OnUploadComplete(0, "File too large!");';
      print  '';
    ?>
    

提交回复
热议问题