android - POST : angularjs app to cakephp site -
I have added the rest of the document like KPPP to my Spatnik Controller:
Add Public Functions () {$ this- & gt; Layout = zero; $ This- & gt; Autorander = False; If ($ -> - $ (- $ -; -;) - Save (save-> Request-> Data) {$ message = array ('text' => (__ ( 'Saved'), 'type' = & gt; 'success'); } Other {$ message = array ('text' = & gt; __ ('error'), 'type' = & gt; 'error'); } $ This- & gt; Set (array ('message' = & gt; $ message, '_serialize' = & gt; array ('message')); }
I put this JS part in my SEO apps (in fact, in the other domain from KPPP site):
and
function message controller ($ radius, $ http) {$ scope.message = {}; $ Scope.createMessage = function () {$ http ({method: 'POST', url: 'http://www.mycakephpdomain.com/spoutnik/add', data: $ scope.message})}}
Nothing is working ... I do not have any errors in Chrome console, I'm completely lost / I just create any Android app with any Java or PHP Want to, and post on my cakefop website. . At the moment, I try to post as another domain (I can not touch the Apache configuration).
What's wrong with my code?
For bus records and debugging purposes:
I did not find the reason for this problem, but looking at the AJAX request made by AngularJS I found that the message data from the form was not sent as regular data. Instead, it was being sent as a request request.
In fact, this error is a response to the JSON response from my view in response to the server:
WARNING (4096): 1 Hassim has arguments 1: ( ) / 8/9 / line called / var /www/test/lib/Cake/Network/CakeRequest.php, the array called, should be taped, and [core / cake / utility / hash.fp, line 44 ]
Of course, I checked that it was not strange to me, I also tried to disable all the security components and gave permission for AT *.
If you set core.debug in php to 0, the error will not be shown and everything will be fine, but it is not what you want for your awesome app. *
I changed query data from $ scope.message to just $ ('form'). Serialize (), but still no way at all, the only solution I've found is to remove $ http.post and know about $ .jax () which always kept its job as usual ...
So my suggestion, $ http.post and user general jQuery.ajax ();
Comments
Post a Comment