Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6530563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:46:15+00:00 2026-05-25T09:46:15+00:00

SOLVED: The problem lies within Firefox 6.0.2 security. I have changed my URL request

  • 0

SOLVED:

The problem lies within Firefox 6.0.2 security.
I have changed my URL request from:
http://mysite.com/ajax/request
to /ajax/request
and Its working.

If you need to use cross domains, you need to use jsonp as your dataType.

Many thanks to evildead


My JSON request to my server returns an empty response.
This only happens in Firefox 6.0.2 and Safari in a Windows Vista machine.

The output is generated by a php script and has json/application headers.

This returns empty response:

    $('#ajaxcall').click(function(){
var ts = new Date().getTime();
var urlz = $('#targeturl').val()+'/'+ts;
var dataString = $("#datazz").val();
$.ajax({  
    type: "POST", url: urlz, data: "data="+dataString, 
    success: function(data){  
        var obj = jQuery.parseJSON(data);

        for (var i = 0; i < obj.length; i++) {
            var object = obj[i];
            for (property in object) {
            var s = property + "=" + object[property] + "<br>";
                $("#console").after(s);
            }
        }
    }  
});
});

As well as this:

$( "#tags" ).autocomplete({
        source: function( request, response ) {
            $.post("http://mysite.com/v2/ajax/tag_suggestion/ab", {data:request.term}, function(data){
                response($.map(data, function(item) {

                if ($('#tagsboxvals').hasClass(item.name.split(' ').join('_'))){
                return null;

                } else {
                return {
                    label: item.name,
                    value: item.name
                }
                }
                }))
            }, "json");
            },
            ....
});

Thanks for your help

Edit: This is what the PHP script is generating:

$arr = array(
    array('name'=>'pizza', 'point'=>'1'),
    array('name'=>'blt', 'point'=>'1'));

    header('Cache-Control: no-cache, must-revalidate');
    header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
    header('Content-type: application/json');
    echo json_encode($arr);

It’s a well formed JSON document.

Headers:
Response Headers
Date Wed, 07 Sep 2011 23:58:42 GMT
Server Apache/2.2.3 (CentOS)
X-Powered-By PHP/5.1.6
Expires Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control no-cache, must-revalidate
Pragma no-cache
Content-Length 29
Connection close
Content-Type application/json
Request Headers
Host mysite.com
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0) Gecko/20100101 Firefox/6.0
Accept application/json, text/javascript, /; q=0.01
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip, deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection keep-alive
Content-Type application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With XMLHttpRequest
Referer http://mysite.com/v2/user/register
Content-Length 8
Cookie city=new york; __utma=100174657.1435105779.1308773648.1314994226.1315368765.113; __utmz=100174657.1315368765.113.98.utmcsr=mysite.com|utmccn=(referral)|utmcmd=referral|utmcct=

Headers Post Response JSON
Object { name=”pizza”, point=1}
[Object { name=”pizza”, point=1}]

It works fine with chrome on the same machine, but not firefox and safari.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:46:15+00:00Added an answer on May 25, 2026 at 9:46 am

    You have to make sure, that your return values are “really” json. Some browsers dont accept json which isn’t syntactically correct.

    so make 100% sure you return something like:

    {"foo": 1, "bar": "foobar"}
    

    this is correct json.

    e.g. this is not:

    {'foo': 1, 'bar': "foobar"}
    

    this is also wrong:

    {foo: 1, bar: "foobar"}
    

    further some advices to your javascript code:

       return {
                    label: item.name,
                    value: item.name
                }
    

    this is not correct, wrap your keys in quotes.
    return {
    “label”: item.name,
    “value”: item.name
    }

    Generally I’ve read many time you should do ajax calls as GET Requests not POST, because POST produces more overhead and traffic. But don’t nail me for that.

    Further, when you want to return e.g. an array from within php, use json_encode($var)

    http://php.net/manual/de/function.json-encode.php

    For your concrete use case return:

    {"name": "pizza", "point": 1}
    

    from within your php script.

    Try this on your page in firebug:

    var obj = jQuery.parseJSON('[{"name":"pizza","point":1}]');
    
        for (var i = 0; i < obj.length; i++) {
            var object = obj[i];
            for (property in object) {
            var s = property + "=" + object[property] + "<br>";
                $("#console").after(s); console.log(s)
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem solved: Thanks guys, see my answer below. I have a website running in
Problem solved, see below Question I'm working in Flex Builder 3 and I have
I have solved this problem, I just need to know what to do. I
I have a similar problem as a previously solved problem of mine, except this
I have a script called 'sess-start.php' which lies in an /include directory within my
I solved Problem 10 of Project Euler with the following code, which works through
PROBLEM SOLVED! STUPID TYPO IN MY CODE! That's my method of my UIScrollView delegate:
(Problem solved now, see answers below) Hello, in my app I am trying to
UPDATE: First problem solved, second one described at the bottom of this post. UPDATE2:
Update II Problem Solved but Why? This has been the biggest headache ever. My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.