variables not working in my json call. keeps trying to open a file on my harddrive

I've managed to figure out how to call my tumblr api and get back what I need. It is working fine as long as I hard-code the address and the other variables in the getJSON call. The minute I try to use variables in the call area, it tries to open a file on my harddrive or it strips off the "http:" at the beginning of my url.

What am I doing wrong?

<!DOCTYPE html>
<head>
    <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.6.2.min.js"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            $("button").click(function () {
            SkipNbr = 0;
            GetNbr = 50;
            var a = "http://api.tumblr.com/v2/blog/";
            var bname = "[myblogname].tumblr.com";
            var c = "/posts/photo?api_key=";
            var MyAPIkey = "myAPIkey";
            var xx = "&limit="+GetNbr+"&offest="+SkipNbr+"?jsonp=?";

            var callstring = "'"+a+bname+c+MyAPIkey+xx+"'";

            console.log(callstring);
            $.getJSON(callstring, function (data) {
          //         $.getJSON("http://api.tumblr.com/v2/blog/[myblogname].tumblr.com/posts/photo?api_key=[myAPIkey]&limit=GetNbr&offset=SkipNbr&jsonp=?", function (data) {
                    console.log(data.response.posts[0].caption);

                    $.each(data.response.posts, function (i, data) {
                        $("div").append(i+1 + " " + data.tags.toString() + "<br>");
                    });
                });
            });
        });
    </script>


 <script type="text/javascript">
 function myFunction()
 {
 SkipNbr = 0;
  GetNbr = 50;
 $.getJSON("http://api.tumblr.com/v2/blog/[myblogname].tumblr.com/posts/photo?api_key=   [myAPIkey]&limit=GetNbr&offset=SkipNbr&jsonp=?", function (data) {
 console.log(data.response.posts[0].caption);
 alert(data.response.posts[0].caption);
 $.each(data.response.posts, function (i, data) {
 $("div").append(i+1 + " " + data.tags.toString() + "<br>");
 });

 }
</script>




</head>
<body>

<button>Get JSON data</button>
 <script type="text/javascript">
 //call after page loaded
 // window.onload=myfunction();
 </script>
<div></div>
</body>

 </html>

Answers


this:

var callstring = "'"+a+bname+c+MyAPIkey+xx+"'";

should be this:

var callstring = a+bname+c+MyAPIkey+xx;

Need Your Help

Force CMake to use C++ compiler for C files with Visual Studio

c++ c visual-c++ cmake

I have generated .h and .c files which must be compiled as C++ files with Visual Studio.

Android choose your app among possibilities to attach image to SMS/MMS message

android image attachment

I have troubles finding information what to do in order to achieve:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.