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

  • SEARCH
  • Home
  • 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 9237579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:33:57+00:00 2026-06-18T07:33:57+00:00

Possible Duplicate: JSONP request: Resource interpreted as Script but transferred with MIME type text/html

  • 0

Possible Duplicate:
JSONP request: “Resource interpreted as Script but transferred with MIME type text/html”

Anyone can let me know what am I doing wrong here will be appreciated.

This is the code with json file on local URL / localhost. And this work with no problem

(function() {
    var json_url = 'http://localhost:8888/MOD/some-folder/app/mysql-to-json.php?page=index';

    $.getJSON(json_url, function(data){
        $.each(data, function(i, item) {
            $('#state-list').append('<li><a href="display.html?state=' + item.d_state  + '" data-transition="slide" rel="external">' + see_abbrv(item.d_state) + '</a></li>');
        });
        $('#state-list').listview('refresh'); 
    });
}) ();

But when I do this, and I just updated the json_url to live url from json_url from localhost.

The data won’t show up. And there is warning when I tried to inspect page:

Resource interpreted as Script but transferred with MIME type text/html: “http://www.live-server.com/app/mysql-to-json.php?page=index&callback=jQuery18201751285600475967_1360047415705&_=1360047415772“.

updated code with live url:

(function() {
    var json_url = 'http://www.live-server.com/app/mysql-to-json.php?page=index&callback=?';

    $.getJSON(json_url, function(data){
        $.each(data, function(i, item) {
            $('#state-list').append('<li><a href="display.html?state=' + item.d_state  + '" data-transition="slide" rel="external">' + see_abbrv(item.d_state) + '</a></li>');
        });
        $('#state-list').listview('refresh'); 
    });
}) ();
  • 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-06-18T07:33:58+00:00Added an answer on June 18, 2026 at 7:33 am

    OP needed cross origin script and was almost there, we changed the PHP file to generate JSONP:

    header('contentType: application/javascript');
    print $_GET["callback"]."(". json_encode($rows) .");";
    

    And changed the JavaScript back to include the parameter “&callback=?”

    (function() {
        var json_url 
            = 'http://www.live-server.com/app/mysql-to-json.php?"
                +"page=index&callback=?';
        $.getJSON(json_url, function(data){
            $.each(data, function(i, item) {
                $('#state-list').append('<li><a href="display.html?state=' 
                    + item.d_state  
                    + '" data-transition="slide" rel="external">' 
                    + see_abbrv(item.d_state) + '</a></li>');
            });
            $('#state-list').listview('refresh'); 
        });
    }) ();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: handle json request in PHP The following: $.ajax({ type: 'POST', url: 'receive-json.php',
Possible Duplicate: Can I comment a JSON file? We are using a .json file
Possible Duplicate: How can I parse JSON in Google App Engine? json module was
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: Very large HTTP request vs many small requests I need a 2D
Possible Duplicate: querystring encoding of a javascript object I'm trying to make a request
Possible Duplicate: Why is it a bad practice to return generated HTML instead of
Possible Duplicate: Able to see a variable in print_r()'s output, but not sure how
Possible Duplicate: JavaScript implementation of Gzip I'm looking for a text (string) compression method
Possible Duplicate: How to send HTTP request and retrieve response in PHP (with fine-tuning

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.