Welcome Guest, Not a member yet? Register   Sign In
input post empty
#8

(This post was last modified: 10-20-2017, 05:17 AM by Valerekk.)

my js function
Code:
function sendLogin(id, email) {
   $.ajax({
       type: "POST",
       contentType: "application/json; charset=utf-8",
       url: "http://www.plickapp.com/API/index.php/users/register_user/",
       data: "{'idfb':'" + id+ "', 'emailfb':'" + email+ "' }",
       success: function (result) {
            console.log("Ok " + result);
       },
       error: function (result) {
           console.log(result);
       }
  });
}

the frontend is hosted in another space (app, localhost, another server)
so i set the header in my controllers for accepting external request with

PHP Code:
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: ACCEPT, CONTENT-TYPE, X-CSRF-TOKEN");
header("Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS, DELETE");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With"); 

could be the .htaccess ?

-------- UPDATE ----------- 
sending data by GET it works.
example
my request

Code:
http://mysite.com/users/register_post_user/?id=5890459084523908&email=testemail

the result is 
Code:
Array ( [id] => 5890459084523908 [email] => testemail )

tested by URL in browser directly and by Postman....
Huh Huh Huh Huh
Reply


Messages In This Thread
input post empty - by Valerekk - 10-19-2017, 03:35 PM
RE: input post empty - by neuron - 10-19-2017, 11:21 PM
RE: input post empty - by Valerekk - 10-20-2017, 01:47 AM
RE: input post empty - by ponzo - 10-19-2017, 11:53 PM
RE: input post empty - by Valerekk - 10-20-2017, 01:49 AM
RE: input post empty - by Narf - 10-20-2017, 02:24 AM
RE: input post empty - by InsiteFX - 10-20-2017, 04:05 AM
RE: input post empty - by Valerekk - 10-20-2017, 04:53 AM
RE: input post empty - by ivantcholakov - 10-20-2017, 09:24 AM
RE: input post empty - by Valerekk - 10-21-2017, 01:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB