0

I am building a search result page that needs to be formatted for the iPhone. I have built a browser based web application in Dashcode and input data from a php file. For this example I will call the php file test.php. Here is the basic model. (the i= is the query for the php)

web app sends i= --------> test.php --------> mysqldatabase

then

mysqldatabase ---------> test.php ----------> JSON output

then

JSON output ------> Dashcode Browser Graphical UI

The data is getting encoded, but not loading into Dashcode's browser UI. Ideas?

PTC
  • 199
  • 1
  • 2
  • 8

2 Answers2

0

It's probably the same-origin policy. Under "Run & Share" enter the domain hosting your PHP file in the "Simulate running on domain:" field (and check the checkbox next to it).

Andy
  • 11,215
  • 5
  • 31
  • 33
0

If you want to go "cross-domain" while testing within dashcode… this proxy.php snippet allows you to enter a URL such as… http://myprivatedomain.com/proxy.php?url=https://some.twitter.jsonapi.url%8483948 and use it all, without whining, from DashCode….

<?php    $filename = $_REQUEST['url'];
         header('Content-Type: application/json');
         ob_start();
         json_encode(readfile($filename));
         ob_flush();                            ?>
Alex Gray
  • 16,007
  • 9
  • 96
  • 118