Thanks Roan, that helped a bit. You were correct, the myFunc() definition
had to be placed before the src. Through further research I discovered (what
I believe is) the exact API call that I need for the output that I desire.
However, I'm still having trouble with JavaScript accessing the returned
value from the callback. At this point, I'm trying to assign the callback
value to a variable and print it to the screen to confirm that I have what
I'm after. So far, the only value I've been able to retrieve from the
callback is:
[object Object]
What I'm after is what is printed to the screen when you go to the following
link:
http://en.wiktionary.org/w/api.php?format=json&callback=myFunc&acti…
Does anybody see where I'm going wrong or have any suggestions?
/////////////////////////////////////////////////////
<html>
<body>
<script type="text/javascript" >
//myFunc("hello");
function myFunc(str){
document.write(str);
//var testVar = JSON.parse(str);
//document.write(testVar);
//location.href = "http://www.myURL.com/test.php?str="+str;
}
</script>
<script type="text/javascript" src="
http://en.wiktionary.org/w/api.php?format=json&callback=myFunc&acti…
</body>
</html>
/////////////////////////////////////////////////////
Thanks again,
Aaron.
On Tue, Jun 15, 2010 at 3:40 AM, Roan Kattouw <roan.kattouw(a)gmail.com>wrote;wrote:
2010/6/15 Aaron Ward <edugamer(a)gmail.com>om>:
<script type="text/javascript"
src="
http://en.wiktionary.org/w/api.php?format=json&callback=myFunc&acti…
">
function myFunc(str){
document.write(str);
document.write("Hrm");
}
</script>
I'm not sure you can mix src="" with content like that. Try using
1)
separate tags for the src="" script and the myFunc() definition and 2)
putting the myFunc() definition *before* the src=""
Roan Kattouw (Catrope)
_______________________________________________
Mediawiki-api mailing list
Mediawiki-api(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api