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 4 of 4

Thread: jquery

  1. #1
    Senior Coder
    Join Date
    May 2004
    Posts
    1,464
    Thanks
    15
    Thanked 0 Times in 0 Posts

    jquery

    sometimes when running

    $.ajax({
    url: urltoajax,
    cache: false,
    success: function(html) {
    $("#formfields").html(html);
    }
    });

    in jquery from a link

    meaning i call my javascript function on click of the link - instead of replacing the div it ads a new one with the new content
    it should replace the div called #formfields

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by esthera View Post
    sometimes when running

    $.ajax({
    url: urltoajax,
    cache: false,
    success: function(html) {
    $("#formfields").html(html);
    }
    });

    in jquery from a link

    meaning i call my javascript function on click of the link - instead of replacing the div it ads a new one with the new content
    it should replace the div called #formfields
    put your code between [ code] and [ /code] tags, please.

    try this way:
    Code:
     $.ajax({
                url: urltoajax,
                cache: false,
                success: function(data) {
                    $("#formfields").replace(data);
                }
            });
    best regards

  • #3
    Senior Coder
    Join Date
    May 2004
    Posts
    1,464
    Thanks
    15
    Thanked 0 Times in 0 Posts
    this gives me an error

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by esthera View Post
    this gives me an error
    i didn't test it, and now i just look thru jquery docs, is replaceWith

    http://api.jquery.com/replaceWith/

    try this and if you get an error, post the error to.

    Edit: forget to say, was my fault,

    best regards


  •  

    Posting Permissions

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