WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
Not working in IE6 (3 posts)

  1. Koshirosan
    Member
    Posted 3 years ago #

    Hi, I'm having a major problem - the JSON API will always throw a 400 error when accessed through IE6. I'm not entirely sure, but it may have something to do with the rewrites. The odd thing is that it works in every other browser!

    Even this fails:

    /json=1

    Any ideas?

    http://wordpress.org/extend/plugins/json-api/

  2. dphiffer
    Member
    Plugin Author

    Posted 3 years ago #

    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

  3. Koshirosan
    Member
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags