Problem with distant server and json_encode

Hello everyone !
I’m having an issue trying to communicate with my remote server.

I want to send informations to my database using $.getJSON or $.post with the json as a fourth parameter.

the problem is that when i click on my submit button nothing happens.

I’m new with AJAX and json stuff, so maybe there’s something i’m doing wrong.

here is my PHP script (stored on the server)

$chaine = '';
if( isset($_GET['chaine']) ){    $chaine = $_GET['chaine'];}

$retour = array(    
'chaine'    => strtoupper($chaine),    
'date'      => date('d/m/Y H:i:s'),
'phpversion'=> phpversion());
header('Content-type: application/json');
echo json_encode($retour);

The client code i’m using on the ionic app is the following :

<form id="form">
    <input name="chaine" type="text" id="chaine" value="Bonjour"/>
    <input type="submit" value="Envoyer" id="handle"/>

<div id="retour">


    jQuery(document).ready(function ($) {
        $('#form').submit(function (e) {
            // On désactive le comportement par défaut du navigateur
            // (qui consiste à appeler la page action du formulaire)

            // On envoi la requête AJAX
                    {chaine: $('#chaine').val()},
                    function (data) {
                                .append('<b>Paramètre en majuscule</b> : ' + data.chaine + '<br/>')
                                .append('<b>Date</b> : ' + + '<br/>')
                                .append('<b>Version PHP</b> : ' + data.phpversion + '<br/>');


Any idea how to make this work ? Is there something i’m missing ?

No one has an idea ? :frowning:

This problem has nothing to do with ionic…
Do not know why you are asking this here…