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
    May 2006
    Posts
    48
    Thanks
    1
    Thanked 0 Times in 0 Posts

    $.ajax and hash(#)

    i couldn't find how to use it,
    when using load i can do
    Code:
    $('#mydiv').load('myurl.php #div')
    this code doesn't work

    Code:
    $.ajax({
        url: 'myurl.php #div',
        success: function(data) {
           $("#mydiv").html(data);
    }
        });

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    I've only ever used load to do it that way so I didn't realize it, but I think it is an actual limitation. based on the wording below from the API I think it's intended. Is there any reason you have to use .ajax()? you can use the same type of callback and so forth you would with .ajax

    The $.ajax() function underlies all Ajax requests sent by jQuery. It is often unnecessary to directly call this function, as several higher-level alternatives like $.get() and .load() are available and are easier to use. If less common options are required, though, $.ajax() can be used more flexibly.


  •  

    Posting Permissions

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