Status
Not open for further replies.

louie

New Member
Sorry maybe I didn't explain what I meant too well:

Rather than:
1. me making a request for the page,
2. the server sending me the page,
3. then my browser (via AJAX) sending two requests for the side_bar and main_body,
4. and finally writing them to the dom via JS (well actually via innerHTML);

why not just build all that on the server at my first request and save the overhead (I am completely missing out on something here?).

If this is just for experiment then keep it up! :)

Rgds

Richard.

You can not request another page using ajax or javascript if the page requested is on a different domain. It's a security built into javascript that doesn't allow it.
If you try you will get a "Permission Denied" error, the reason we use fopen or curl function.

I tried it but it didn't work.

The page requested has to be executed on the domain that owns the page, then send it over to the requesting party.
 

RedCardinal

New Member
You can not request another page using ajax or javascript if the page requested is on a different domain. It's a security built into javascript that doesn't allow it.
If you try you will get a "Permission Denied" error, the reason we use fopen or curl function.

I tried it but it didn't work.

The page requested has to be executed on the domain that owns the page, then send it over to the requesting party.

Yep I understand the issues with x-domain requests. What I dont know is why you are doing this in the browser? Apart from experimenting with this, is there any reason why you are doing these page refreshes via AJAX? You could do everything that you re doing on the server and just serve up the pages via normal HTTP requests.

When I request Seller your server sends me a template file and then sends 2 xmlhttprequest calls to your server for left_menu and main_body which get populated to the template. Why not just send the entire page with the first request? Less bandwidth, less overhead, less hassle.

BTW there are ways to get arounf the cross-domain security issues ;) try a hidden I-Frame.
 

louie

New Member
When you view the products, you only see 20 of them at one time, so as you said I could bring all that with one go, but one seller could have 500-1000 products, and every product has 1 or more large images plus a very large description (some of them), so what am i going to do then?

Those pages is going to have some paging function at the top and bottom for navigating trough them if more then 20 per category.

Regarding iframes - i don't like them so i don't want to use this option.
 

RedCardinal

New Member
I made a quick page for the start without using ajax onload event to write some source into the background for SEO here:
Seller#

that will probably be better, what do you think?

Forgetting all about the technology, that page loads a lot quicker and as a user I will apreciate this.

FYI when I click on a product the div you insert in the page has width:100% so on Firefox that stretches the screen over on the right hand side. You might want to check this out.

Rgds

Richard
 

louie

New Member
Thanks, i got it sorted out.
It was actually the div for the image itself - had width:110px set for some stupid reason.

removed that and it looks fine know.
 

georgiecasey

New Member
As per the original topic, I've downloaded and used a lot of AJAX books and the best IMHO is definately 'Professional AJAX' by Nicholas Zakas
 

louie

New Member
Didn't get my hands on that one yet, but as far as I can tell, it's very easy to get the hang of it. There are few rules creatting the request, the rest is left to your imagination, so wastting more money on books is not worth it, not now anyway. I am looking into getting the back button to work as well, and once that's done it's all go go.
 
Status
Not open for further replies.
Top