Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-21-2009, 02:54 PM   PM User | #1
GaVrA
New Coder

 
Join Date: Jun 2009
Posts: 35
Thanks: 4
Thanked 1 Time in 1 Post
GaVrA is an unknown quantity at this point
having problems with load()

Hi.

I am trying to load some elements from external page which is like a search result into mine page and show those elements:

http://www.vizioshop.com/browse.php?q=crtaci.info

This is what i have:

Code:
<script type="text/javascript">
$(function() {
        $("#result").load("http://www.vizioshop.com/browse.php?q=crtaci.info .tShirt");
});
</script>	
<div id="result""></div>
So i want to load elements with class of "tShirt" and show them on my page and few other stuff, but im stuck on this "load issue"...
GaVrA is offline   Reply With Quote
Old 08-21-2009, 05:56 PM   PM User | #2
Spudhead
Senior Coder

 
Spudhead's Avatar
 
Join Date: Jun 2002
Location: London, UK
Posts: 1,856
Thanks: 8
Thanked 110 Times in 109 Posts
Spudhead is on a distinguished road
You don't say what your "load issue" actually is, but I'll take a guess that what you're having problems with is the fact that for security reasons, browsers won't allow AJAX requests for pages that aren't on the same domain as the requesting page.

There are several solutions

The "Cross domain proxy" mentioned in the link above can be as simple as a PHP file on your server that contains the following:

Code:
<?php
header('Content-type: text/html');
$url = $_GET['url'];;
echo file_get_contents($url);
?>
Spudhead is offline   Reply With Quote
Users who have thanked Spudhead for this post:
GaVrA (08-21-2009)
Old 08-21-2009, 06:37 PM   PM User | #3
GaVrA
New Coder

 
Join Date: Jun 2009
Posts: 35
Thanks: 4
Thanked 1 Time in 1 Post
GaVrA is an unknown quantity at this point
I thought that was the problem, i mean i do remember reading about that bolded problem...

I think i will have to do something less advanced... :lol: Like code similar page on my site...
GaVrA is offline   Reply With Quote
Old 09-02-2009, 07:49 PM   PM User | #4
GaVrA
New Coder

 
Join Date: Jun 2009
Posts: 35
Thanks: 4
Thanked 1 Time in 1 Post
GaVrA is an unknown quantity at this point
Ok i came up with something, so i would like you guys to tell me what is the better way to do this... I have 3 dummy html pages that i am loading.

http://www.crtaci.info/majice20.html
http://www.crtaci.info/majice40.html
http://www.crtaci.info/majice60.html

This is finall result:

http://www.crtaci.info/index.php?autocom=majice

And this is the code:

PHP Code:
<script type="text/javascript">
$(function() {
    $.
ajaxSetup ({
        
cachefalse
    
});
    
    var 
ajax_load "<img style='width:42px;height:42px;display:block;margin:auto;' src='style_images/freshair/load.gif' alt='loading...' />";
    
    $(
"#majice").html(ajax_load).load("majice20.html", function(){
        $(
".tShirt").removeAttr('title');
    });
    $(
"#show").click(function(){
        $(
"#shown").slideToggle(1000);
    });
    $(
"#1").click(function(){
        $(
"#majice").html(ajax_load).load("majice20.html", function(){
            $(
".tShirt").removeAttr('title');
        });
        $(
"ol.majice_navigacija>li").removeClass("selected");
        $(
this).addClass("selected");
    });
    $(
"#2").click(function(){
        $(
"#majice").html(ajax_load).load("majice40.html", function(){
            $(
".tShirt").removeAttr('title');
        });
        $(
"ol.majice_navigacija>li").removeClass("selected");
        $(
this).addClass("selected");
    });
    $(
"#3").click(function(){
        $(
"#majice").html(ajax_load).load("majice60.html", function(){
            $(
".tShirt").removeAttr('title');
        });
        $(
"ol.majice_navigacija>li").removeClass("selected");
        $(
this).addClass("selected");
    });
});
</script>
<div class="maintitle">{$this->ipsclass->lang['welcome_message']}</div>
    <div id="show" style="background:#CAEBFF;padding:10px;cursor:help;"><a title="Klikni da pročitaš uputstvo!" style="font-size:20px;font-weight:bold;margin:auto;width:100px;padding:10px;display:block;">Uputstvo!</a><div id="shown">Da bi ste kupili majicu treba prvo da kliknete na izabranu majicu, pa kada vam se otvori novi prozor ovde treba da izaberete boju, veličinu, količinu i da li želite mušku ili žensku majicu. Nakon toga treba da kliknete na "Dodaj proizvod u korpu".<img style="margin:10px auto;width:530px;display:block;" src="http://i25.tinypic.com/2reldfk.png" alt="Info"></a></div></div>
    <ol class="majice_navigacija">
        <li id="1" class="selected">1</li><li id="2">2</li><li id="3">3</li>
    </ol>
    <div id="majice"">
        
    </div>
    <br clear="all"/>
<div class="catend"></div> 
GaVrA is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:17 PM.


Advertisement
Log in to turn off these ads.