Advanced Search

Results 1 to 4 of 4

Thread: jquery callback href

  1. #1
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default jquery callback href

    can anyone lend a hand?
    i want to click an image and have jquery:

    -hide that image
    -then call a href to test.php

    this does not seem to work
    Code:
     $("img").click(function () {
    	$("img").hide(1000,function(){
    	  $.get("test.php");
    	});
    });

  2. #2
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    i found this link
    http://curtishenson.com/quick-tip-de...g-with-jquery/
    but i dont see a reference to href

  3. #3
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    maybe something like this?
    but this still doesnt work

    Code:
    $('img').click(function(e){
    	var toLoad = $(this).attr('test.php');
    	$("img").hide(1000);
    	setTimeout(function(){window.location = toLoad}, 1000);
    	e.preventDefault
    });

  4. #4
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    got it working like this, but why does that variable not work?
    Code:
    $('img').click(function(e){
    	$("img").hide(1000);
    	setTimeout(function(){window.location = 'test.php'}, 1000);
    	e.preventDefault
    });

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
  •