dregduc63699 2012-03-19 14:17
浏览 41


I am doing file upload async with jquery/php using the target attribute of a form. The target is my iframe named "uploads"; To manage error in the php file, I return string like "ERR_TOO_LARGE_FILE" with an echo which will be inside the iframe body.

The problem is I don't know how to detect when the iframe is ready and access its content to see if there's an error. I tried the following code but it didn't work:

$("#uploads").on("load", function() {

an alert box did appear, but nothing inside. I also tried using the ready event instead but this time, nothing appears.

Would like to know a way to achieve this or an alternate solution if you have a better one.

  • 写回答

1条回答 默认 最新

  • dongyu3659 2012-03-19 14:34

    Because you're not allowed to modify the content of an iframe, at least you're not suppose to, you can't directly access it using jquery. Use .contents() & .find() to get the html from the iframe so you can get the info you need.


    $("#uploads").on("load", function() {

    should return the contents of the html in the iframe. You can swap out the 'html' for a tag id if you know the specific element you're looking for.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥20 icefall在librispeech基础上加入个人数据集
  • ¥30 keepalive高可用故障运维配置询问
  • ¥15 求帮助!国家电网内网u盘突然识别不出来了。
  • ¥15 matlab语音变速变调同时实现
  • ¥15 如何用Thoony写ESP32温湿度检测无源蜂鸣器报警代码?
  • ¥20 部件内部的CT图像数据集
  • ¥15 Visual studio调用动态库
  • ¥15 双目摄像头标定后的校准文件
  • ¥15 powerbi矩阵增加度量值后出现对应关系错乱
  • ¥30 频率分析法分析绘制奈奎斯特图、波特图