Using jquery mobile + phonegap, trying to do a POST for a Slim application, I have this code:
$( document ).on( "vclick", "#test_form", function() { $.ajax({ type: "POST", url: "http://mydomain.com/slim/", crossDomain: true, beforeSend: function() { $.mobile.loading('show') }, complete: function() { $.mobile.loading('hide') }, data: {namec:$("#namec").val()}, dataType: 'json', success: function(response) {
I tested this with other pages than Slim PHP and everything works fine, I get an ajax error using Slim.
My Slim app:
<?php require 'Slim/Slim.php'; \Slim\Slim::registerAutoloader(); $app = new \Slim\Slim(); $app->post('/', function () { echo json_encode($_POST("namec")); }); $app->run();
Just started using Slim, so I'm not sure what I can do wrong.
source share