jQuery POST vs GET (problem) in Apache Cordova
Hi to all,
Firstly I´d like to apologize for my English if it is not correct.
I have a problem passing variable from jQuery POST method to my PHP file. I am coding in Apache Cordova for Android. I have this function in JS file:
- //.....deletes clicked invitation .......... //
- function invitation_delete() {
- $(document.body).on( 'tap', '.events_pinned_invitations_button_delete', function () {
- console.log("ok");
- var invitation_id = ($(this)).data("invitation_id");
- console.log(invitation_id);
- $.post('http://10.0.0.2/habitoo15/mobile/invitations_delete.php' , {invitation_id: invitation_id}, function(data) {
- console.log(data);
- });
- });
and this is php file:
- $invitation_id = $_POST['invitation_id'];
- echo $invitation_id;
If I click the button, console will output:
"ok" ... ( expected )
"1" ... ( expected - right number )
" " ... ( unexpected, seems like variable got lost on the way and it takes like 5 seconds before console outputs last line )
If I use GET method insted of POST ( in both files ), console will output:
as I would expect. Also I need to pass 2 variables ( second one being string ). If I try that, then the "1" passes ok but the string is cutted in the middle and console outputs just first part of it.
Thanks for any help or explanation.
Tomas