...

View Full Version : [JQuery]Js problem...



stone28
12-24-2009, 01:11 PM
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;
}
});

Fumigator
12-24-2009, 05:25 PM
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.

stone28
01-13-2010, 01:42 PM
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
}
});

tomws
01-13-2010, 05:25 PM
Please wrap your code in appropriate tags. It's much easier to read.

A quick glance at the jquery ajax docs (http://docs.jquery.com/Ajax/jQuery.ajax#options) suggests you should do something like this:

returnValue = $.ajax({
/* other stuff */
}).responseText;
return returnValue;

stone28
01-13-2010, 06:21 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum