I was told that $.getJSON is the best way to send data to and from external servers. I probably wasted 7 hours of my time trying to use JQUERY's Ajax to do so just to find out that no browsers allow that type of method. I would like to send the data using the Jquery getJSON and I am using cakephp as my receiving end (i.e. My external server) Here is what i have so far.
$.getJSON("http://play.mysite.com/usersessions/store/",{ data: "Hi!"});
I don't want a callback because I dont need it. I just need to send some data to the external server. This is MVC site so usersessions is my controller, store is my action.
Below is my cakephp code. If you don't know it then that is fine. I just really need to know if I am sending the getJSON data correctly
<?php class UsersessionsController extends AppController {
var $name = 'Usersessions';
var $helpers = array('Html', 'Form','Ajax');
var $components = array('RequestHandler');
function store()
{
Configure::write('debug', 0);
$this->autoRender = false;
if($this->RequestHandler->isAjax()) {
if ($this->params['url']['data'])
{
$this->data['Usersession']['data'] = $this->params['url']['data'];
$this->Usersession->Save($this->data);
echo 'Success';
}
}
}
} ?>
Thanks you!