Discussion in 'Coding Help' started by louie, Jul 26, 2006.

  1. louie

    louie 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.
  2. RedCardinal

    RedCardinal New Member

    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.
  3. louie

    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.
  4. RedCardinal

    RedCardinal New Member

    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.


  5. louie

    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.
  6. georgiecasey

    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
  7. louie

    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.

Share This Page