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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    [JQuery]Js problem...

    Hi,

    I am using plugin tooltip from jquery and I have small problem...

    How can I return the value of the ajax request? It is comming through I can put is in the alert box or so but not on the level where I need to return that valu to the bodyHandler. Please help.

    $(".entry_with_comments").tooltip({
    bodyHandler: function() {
    var returnValue, movieID;
    movieID = $(this).attr("id");

    $.ajax({
    type: "POST",
    url: "testHTML.asp",
    data: "movieID="+movieID,
    success: function(msg){
    returnValue = msg;
    //alert(returnValue);
    }
    });
    //$(returnValue).load("testHTML.asp", {'movieID': movieID}, function(){
    //alert("asdasdd " + movieID);
    return "njij " + returnValue;
    }
    });
    Last edited by Kor; 12-24-2009 at 02:10 PM. Reason: JQuery prefix added and moved to the Frameworks section

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    There are dozens of tooltip plugins on the jQuery website; can you be more specific which one you're using? As in, provide a link to the plugin's page on jQuery.com.

  • #3
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    It's jquery-tooltip plugin..

    http://docs.jquery.com/Plugins/Tooltip

    So again, what do I have to put in line marked as ### to return result from ajax request:

    $(".entry_with_comments").tooltip({
    bodyHandler: function() {
    var returnValue, movieID;
    movieID = $(this).attr("id");
    $.ajax({
    type: "POST",
    url: "testHTML.asp",
    data: "movieID="+movieID,
    success: function(msg){
    returnValue = msg;
    }
    });
    //###what do I have to put here to return "msg" from the ajax request
    return returnValue; //unidentified
    }
    });
    Last edited by stone28; 01-13-2010 at 03:48 PM.

  • #4
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Please wrap your code in appropriate tags. It's much easier to read.

    A quick glance at the jquery ajax docs suggests you should do something like this:
    Code:
            returnValue = $.ajax({
              /* other stuff */
            }).responseText;
            return returnValue;
    Are you a Help Vampire?

  • #5
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    THANK YOU VERY MUCH!!!!!!!

    Too be honest just few hours ago I found that myself!!! But it's great to see that somebody is here with help ;-)

    Thanks for your time.


  •  

    Posting Permissions

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