Use hidden iframe to submit data

后端 未结 3 1679
夕颜
夕颜 2021-01-21 08:49

I need to submit some information to my servlet. Once I submit this information, I\'ll receive a PDF from the servlet based on the data. I know I can construct the URL and pass

相关标签:
3条回答
  • 2021-01-21 09:16

    In my eyes, using the hidden Iframe method is very old school, almost like before the great days of Ajax methods.

    You can use jquery Ajax call and serialize your full form passing all variables. Remember to check your request size in your config, in case it post reaches maximum size.

    0 讨论(0)
  • 2021-01-21 09:21

    Hm, which way do you want to sent the data using your iframe? I think you're limited to either GET or POST there, too. Means, if your data is too large, the iframe won't help sending your data.

    What server backend do you use? You might be able to configure the maximum size of request data (post / get).

    Please have a look at this message for more information about this.

    0 讨论(0)
  • 2021-01-21 09:32

    You'll need to set the target to the iframe you want to submit it to.

    <form action='...' name='theform' target='theiframe'>
      . 
      .
      .
      <iframe name='theiframe' src='...'> 
      </iframe>
    </form>
    

    This forum post has some details : http://forums.powweb.com/showthread.php?t=77213

    0 讨论(0)
提交回复
热议问题