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 7973139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:01:46+00:00 2026-06-04T08:01:46+00:00

I have a file under webroot folder out of cakephp default installation and I

  • 0

I have a file under webroot folder out of cakephp default installation and I want to get a json response back. But when I try to do that I get this error

XMLHttpRequest cannot load http://test.com/companies/all_company_information. Origin http://dev.local is not allowed by Access-Control-Allow-Origin.

 $.ajax({

         type: 'POST',
         url: '/controller/method',
         dataType: 'json',
         success: function(data){

             console.log(data);

         }

     });

I have read up on some of the info on google but I think I am not understanding this.

EDIT

when I use jsonp I get this error

Resource interpreted as Script but transferred with MIME type text/html:

$.ajax({

         type: 'POST',
         url: '/controller/method',
         dataType: 'jsonp',
         success: function(data){

             console.log(data);

         }

     });
  • 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-04T08:01:48+00:00Added an answer on June 4, 2026 at 8:01 am

    Try creating a function in an appropriate controller that is setup to respond with the intended json. A controller configured to respond with json:

    function feed($date){
    $this->layout = 'ajax';
    $this->autoLayout = false;
    $data = $this->Model->find();
    echo json_encode($data);
    }
    

    I use the firefox extension firebug heavily in order to ensure my ajax requests are going through and what their responses are.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have same class file under classes folder and also in jar file inside
I have local html file under my assets folder. I am loading this file
I have an xml file under res folder, the structure is res/raw/myfile.xml. Now i
I have this database file under the usual databases folder and a bunch of
I have a zip file that i must update an file under a folder
I have this code that deletes a specific file under a folder that I've
Is there a way to have the file reference work under ipad? The file
I have a file we will call info.txt under UNIX format that has only
I have a file UTF-8 encoding in windows, and when i use it under
I'm confused with file moving under python. Under windows commandline, if i have directory

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.