Results 1 to 3 of 3

Thread: Ajax Jquery combination

  1. #1
    Join Date
    Apr 2008
    Location
    Little Office!
    Posts
    80
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default Ajax Jquery combination

    guys,

    i found this script over googling.

    this is a very basic yet poweful thing.

    it displays a html page on click and shows a loading image.
    (this is all done using axax)

    The problem is that this script only displays one html document and we are looking to display more.

    Thanks.

    http://www.electrictoolbox.com/load-...loading-image/

    coding as following

    HTML Code:
     <script language="javascript">
    function example_ajax_request() {
      $('#example-placeholder').html('<p><img src="http://www.electrictoolbox.com/images/ajax-loader.gif" width="220" height="19" /></p>');
      setTimeout('example_ajax_request_go()', 2000);
    }
    function example_ajax_request_go() {
      $('#example-placeholder').load("sample_tutorials.html");
      
    }
    </script></p>
    <p><input type="button" value="Click Me!" onclick="example_ajax_request()" /></p>
    <div id="example-placeholder">
    <p>Placeholding text</p>
    </div>
    now the sample_tutorials.html is the file which is being displayed and what i need is to display more a new file on each click.

    thanks.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code:
    <script type="text/javascript">
    function example_ajax_request(page){
      $('#example-placeholder').html('<p><img src="http://www.electrictoolbox.com/images/ajax-loader.gif" width="220" height="19" /></p>');
      setTimeout(function(){example_ajax_request_go(page);}, 2000);
    }
    function example_ajax_request_go(page){
      $('#example-placeholder').load(page);
    }
    </script>
    <p><input type="button" value="Tutorial" onclick="example_ajax_request('sample_tutorials.html');" /></p>
    <p><input type="button" value="Something Else" onclick="example_ajax_request('some_other.html');" /></p>
    <div id="example-placeholder">
    <p>Placeholding text</p>
    </div>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    A good menu for testing Ajax is the AnyLink Css Menu. Including this menu with the Ajax function given above does not give us what we want. The menu is there, but it does not function. So the Ajax/script is less powerful as you may think.
    °°°
    Arie Molendijk.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •