PDA

View Full Version : IE issue for jquery load



letom
04-24-2013, 11:29 AM
Hi john

Iam using following function for loading a layer( "id = requestpgr")from a page requestpassword into a layer loader using following code in jquery

$('#loader').load('<?php echo get_site_url(); ?>requestpassword #requestpgr');

Iam getting fine result in mozilla but in IE it is not getting loaded...How can we solve the issue in IE ?

Rgds
Tom

letom
04-24-2013, 03:45 PM
The cause of load issue of Jquery in IE is due to the problem of caching OR bad validation of loading file...

Which is the best Document type that support JavaScript and all major html tags UL LI and more ?

jscheuer1
04-24-2013, 03:46 PM
<?php echo get_site_url(); ?>requestpassword

Must be a valid HTML document with mime type text/html. If it's not, there could be problems in some browsers.

Does the page at <?php echo get_site_url(); ?>requestpassword have a name and extension? If so, use them. If it's the index file, try adding the /:


<?php echo get_site_url(); ?>requestpassword/

You might be better off skipping the #requestpgr part and ensuring instead that:


<?php echo get_site_url(); ?>requestpassword

serves only the HTML code that you want imported.

If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.

letom
04-24-2013, 07:07 PM
John

Thanks for your message.

Does the page at <?php echo get_site_url(); ?>requestpassword have a name and extension?
Yes it is a php file requestpassword.php


You might be better off skipping the #requestpgr part and ensuring instead that:
It is important for me, otherwise the page will fully loaded in that layer, i need only the request password box.. if iam adding that can u explain the issues happen ?
If it is working in Mozilla, IE 8 and IE6 then is it fine with other browsers ?

jscheuer1
04-25-2013, 12:03 AM
Is it:


<?php echo get_site_url(); ?>requestpassword.php

or:


<?php echo get_site_url(); ?>requestpassword/requestpassword.php

or something else?

Whatever it is, you need to put the full path and filename, including the extension in the load() command. Without that, I'm surprised it works in any browser.

That might be the only problem.

If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.

letom
04-25-2013, 04:42 AM
Is it:


<?php echo get_site_url(); ?>requestpassword.php

or:


<?php echo get_site_url(); ?>requestpassword/requestpassword.php

or something else?

Whatever it is, you need to put the full path and filename, including the extension in the load() command. Without that, I'm surprised it works in any browser.

That might be the only problem.

If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.

:) :)
No The exact url location is <?php echo get_site_url(); ?>requestpassword .. (http://localhost/requestpassword) the coding of requestpassword is in php file. As is said the issue is in IE only, because there is invalid markup in the loading page. That why i asked which is the best Doctype that support javscript and UL Li tags.

An Example of Doctype

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" id="vbulletin_html">

More over What is the problem arise if we call a layer in load function (ref to your following quote)

You might be better off skipping the #requestpgr part and ensuring instead that:
I can't find any issue for calling these stuff in IE 7 and Mozilla..


please include a link to the page on your site that contains the problematic code so we can check it out
If iam including that link , it will waste the time of both of us, because these results and produced from a large lib of functions, No need of that to correct the issue in HTML markup. its indeed an time wasting technique.

jscheuer1
04-25-2013, 06:01 AM
The DOCTYPE isn't important. Pick any standards invoking DOCTYPE you like. Some will be easier to validate to than others though. Pick the one that has the fewest errors and work from there.

That link is on your own computer. I will need a live link to be of much more help.

What I would do is load the page in the browser, perhaps posting to it if need be to get it to load up. Once it's in the browser, it can be validated. However, the browser might be error correcting it, so you may have to compare the view sorce of the browser to the actual code of the page to tell.

If I had the full code of the page, I might be able to tell something from that.

The reason why using the #requestpgr might be a part of the problem is that where it is, or how it is there might be more invalid than the rest of the page. You can try loading the entire page into a display none div, then appending the element with the id of requestpgr to your target div. Something like:


var temp = $('<div style="display: none;"></div>').prependTo(document.body);
temp.load('<?php echo get_site_url(); ?>requestpassword', function(){
$('#loader').append('#requestpgr', temp);
temp.remove();
});

Added Later:

If the above code doesn't work, it might still write the external page to temp div. If you remove the 2 highlighted lines, you can use IE 8's developer tools to look at the temp div and see what's in there. You can even copy its HTML to run through the validator.

Another thing I'm thinking is that if requestpassword is a page, give it the php extension and use it with that in the command.

letom
04-25-2013, 07:24 PM
Thanks for your kind advice.. Yes it is a good idea, if any further issues i will post.
Also i want to confirm according the above logic, the validations of forms in JavaScript will occur in that loading page ?


Another thing I'm thinking is that if requestpassword is a page, give it the php extension and use it with that in the command.
No that php extension will not work, according to the function written the page is only accessed by localhost/requestpassword .. if we are providing the correct path of our page files in JavaScript, it is publicly avial and may cause security issues i mean ? all must see where the design is located

letom
04-26-2013, 01:49 PM
John

Did u noted this in jquery load function

While using load function in jquery we don't want to use hide() before loading the next content. I think this load function will automatically hide the current content and displays the next loading content in that place.

My doubt is if we are not using hide before the next loading content as follows, some browsers will display both content(next loading content and previously loaded content) in the layer #content ?


$('#content').load('<?php echo get_site_url(); ?>login #login');

$('#login').hide();
$('#content').load('<?php echo get_site_url(); ?>forgotpassword #fgp');

$('#fgp').hide();
$('#content').load('<?php echo get_site_url(); ?>register #register');

but iam not using hide now, getting right result in IE 8 and Mozilla

jscheuer1
04-26-2013, 02:33 PM
Nothing about that in the manual on load:

http://api.jquery.com/load/

And it makes no sense to me, the new content is to replace the existing HTML of the target element. I suppose it's possible in some cases. Like with my suggested code, because I use append, if you were to do it a second time, you would have two sets of responses, so should empty() the target:


var temp = $('<div style="display: none;"></div>').prependTo(document.body);
temp.load('<?php echo get_site_url(); ?>requestpassword', function(){
$('#loader').empty().append('#requestpgr', temp);
temp.remove();
});

What exact code did you end up with that's working? Did you have to change anything on the requestpassword page?

letom
04-26-2013, 07:24 PM
Thanks

What exact code did you end up with that's working? Did you have to change anything on the requestpassword page?

Only i need to add a layer #fgp in requestpassword page then call him in the layer content using the code
$('#content').load('<?php echo get_site_url(); ?>forgotpassword #fgp');
there is a register page also, iam loading that page in the same way using #register as said(coding) in the previous post

Then my doubt is these two layer(#register and #fgp) will display together @ same time in content layer in any browsers.. if iam using the coding i had given ?(But there is no problem with IE and Zilla with that coding) Or the best practice is using the code you suggested for my doubt ?

jscheuer1
04-26-2013, 07:34 PM
No. The code I gave was only if there were still a problem. If it's working, as I said there's no mention of hiding things in the manual. What you do while new content is loading is up to you, but you don't have to hide it or do anything. In fact, if you do .hide() it, you will have to .show() it later, or no one will see it. Some people like to put the word Loading in there, or a loading image (example using the text 'Loading . . .'):


$('#content').html('Loading . . .').load('<?php echo get_site_url(); ?>forgotpassword #fgp');

But you don't need that.

letom
04-26-2013, 07:40 PM
Well, Noted the contents
Exactly you come to the point i am going to do :) thanks .. if any doubts, i will post :)