Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2009
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    jquery problem with .load

    I want to load everytime user click on Add more a page test.html where are inside html stored text fields for form. The problem is everytime I call the function, it removes the first test.html and shows again test.html but it should show an extra one without removing the first one. How to do that?

    $(function() {

    $('#clickme').click(function() {
    $('#include').load('test.html');

    Tnx!

  • #2
    Regular Coder
    Join Date
    Feb 2009
    Location
    Wheeling, IL
    Posts
    358
    Thanks
    5
    Thanked 62 Times in 60 Posts
    jQuery load does exactly that... loads the contents of a file and puts them inside a location specified. You might want to use this instead (From jQuery's AJAX API):

    Code:
    $.ajax({
      url: "test.html",
      cache: false,
      success: function(html){
        $("#results").append(html);
      }
    });
    And the link to the page:

    http://docs.jquery.com/Ajax/jQuery.ajax

    I'm sure you can figure it out.
    The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

    How to ask smart questions?


  •  

    Posting Permissions

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