Wednesday, February 3, 2010

[jQuery] JSON + variable

Hello,

well i got a problem with using JSON.

My code looks like this:

$(function()
{

$.ajax({
type:'GET',
url: url,
data:"format=json&id=123",
success:function(data) {
alert(data); // doesn't work
},
dataType:'jsonp'
});

});

The URL is an external one.
The answer looks something like this:

yasearch({"q":"uboot","f":["k"],"r":[["uboote"],["uboot chat"],["uboot
pc spiel"],["uboot simulation"],["modell uboot"],["uboot hamburg"],
["uboot museum"],["atom-uboot"],["uboot ping"],["rc uboot"]]})

I always get this error msg in firebug:
yasearch is not defined

I tried to define it in any way but it doesn't seem to work. I use
JSON for the first time now and don't know how to get an useable
answer.

I hope someone can help me.

No comments: