Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author dphiffer

    (@dphiffer)

    Hi Koshirosan,

    Do you have a URL you could post here? Could it be that you’re leaving out the ? symbol in the URL? i.e., /?json=1 instead of /json=1.

    Hope that helps,
    -Dan

    Thread Starter Koshirosan

    (@koshirosan)

    Ah sorry that was my typo in that message – I was using the question mark. For anyone else that encounters this, I had two problems, one of which was my fault, the other not so much:

    1) When doing a JSON request via ajax, arguments should be passed in as an object under ‘data’, such as:

    var scope = this;
    $.ajax({
    	url: "a url",
    	data: {post_type: "my_post_type", id: 4, json: "get_post"},
    	dataType: "json",
    	scriptCharset: "utf-8",
    	type: "POST",
    	success: function(data, msg) {
    	scope.myData = data;
    	scope.onJSONLoadComplete();
    	},
    	error: function(request, status, error) {
    		alert("JSON Load Error- status:" + status + " Error: " + request.status);
    	}
    });

    Doing a request leaving ‘data’ blank and having the ‘url’ like “www.mywebsite.com/?json=1&post_type=my_post_type&id=4” will work in the majority of browsers, but doesn’t work in IE6.

    2) IE6 has a bug that means doing the above with the GET method will result in a 400. This isn’t an issue with the JSON API, it’s a browser bug. This is simply solved by using POST instead.

    Anyway hope this helps someone.

    Thanks for the plugin dphiffer, it really is a major feature for WordPress.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: JSON API] Not working in IE6’ is closed to new replies.