[jQuery] Re: return value of nested functions is always undefined

2009-06-23 Thread anawak82
Hi Rob, thank you for your quick reply! Add a return statement to getPrice, maybe something like: function getPrice(id) { return $.get('db.xml', function(d){ ... }); I am sorry to say that this only return a XMLHttpRequest but not the value of the variable price. Kind

[jQuery] Re: return value of nested functions is always undefined

2009-06-23 Thread RobG
On Jun 23, 4:31 pm, anawak82 anawa...@googlemail.com wrote: Hi Rob, thank you for your quick reply! Add a return statement to getPrice, maybe something like:   function getPrice(id) {     return $.get('db.xml', function(d){       ...     }); I am sorry to say that this only

[jQuery] Re: return value of nested functions is always undefined

2009-06-23 Thread Scott Sauyet
anawak82 wrote: function getPrice(id) { $.get('db.xml', function(d){ $(d).find('data').each(function(){ var $data = $(this); if ($data.find(id).text() == id) { var

[jQuery] Re: return value of nested functions is always undefined

2009-06-22 Thread RobG
On Jun 23, 6:24 am, anawak82 anawa...@googlemail.com wrote: Hi, I am just trying to learn a little bit about jQuery. Now I have a problem with returning a value from a function. The following code works fine, when I tested it with alert(price) or any other way of echoing the value