jQuery .load() function + IE + dynamic URL = hair loss

风格不统一 提交于 2020-01-16 09:05:16

问题


IE is having diffculty with dynamic urls in the jQuery load function.

Here's my code snippet:

var formValues = $('#testing').serialize();
var URL = "test.cfm?" + formValues;
var dialogOpts = {
modal: true,
bgiframe: true,
autoOpen: true,
height: 500,
width: 500,
draggable: true,
resizable: false,
closeOnEscape: false,
open: function() {
//display correct dialog content
$("#dialogContainer").load(URL}
};
$("#dialogContainer").dialog(dialogOpts);

Now mind you, if I changed URL to something static like "thisHTMLfile.html", this will work flawlessly in FF and IE. But since the URL is dynamic IE barfs. I get a blank dialog. It's as if IE won't do the ajax call.

i've tried the idea of putting a random value in the string to make it a unique url so that IE won't cache the url, no dice.

I've also checked the test2.cfm file for any HTML errors. No problems here.

Has anyone come across this?

Thanks!


回答1:


@Karim79: yes that would screw me up, but that was just me typing into the screen here. It is correct on my code though.

I did figure out the issue. My Coldfusion localhost has internal debugging set to ON. It shows me all the code and processes that ran for the page. I think this extra code spew was making IE barf. So I turned off debugging output and voila. My IE 6 headaches went bye bye :)




回答2:


It could just be a typo, but this looks fishy:

open: function() {
//display correct dialog content
$("#dialogContainer").load(URL} <<< this curly brace
};

open: function() {
//display correct dialog content
$("#dialogContainer").load(URL) <<< should be a closing parentheses ')'
};


来源:https://stackoverflow.com/questions/1023442/jquery-load-function-ie-dynamic-url-hair-loss

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!