SyntaxError: JSON.parse: unexpected end of data at line 1 column
Résolu/Fermé
gretin
Messages postés
6
Date d'inscription
mardi 6 mai 2014
Statut
Membre
Dernière intervention
13 juin 2015
-
Modifié par jordane45 le 13/06/2015 à 01:41
gretin Messages postés 6 Date d'inscription mardi 6 mai 2014 Statut Membre Dernière intervention 13 juin 2015 - 13 juin 2015 à 02:05
gretin Messages postés 6 Date d'inscription mardi 6 mai 2014 Statut Membre Dernière intervention 13 juin 2015 - 13 juin 2015 à 02:05
A voir également:
- Json.parse: unexpected end of data at line 1 column 1 of the json data
- Syntaxerror: 'return' outside function - Forum Python
- Uncaught syntaxerror: expected expression, got '<' ✓ - Forum Javascript
- Syntaxerror: non-ascii character '\xc3' - Forum Python
- Syntaxerror eol while scanning string literal ✓ - Forum Python
- Pip install syntaxerror: invalid syntax ✓ - Forum Python
3 réponses
jordane45
Messages postés
38454
Date d'inscription
mercredi 22 octobre 2003
Statut
Modérateur
Dernière intervention
22 mars 2025
4 740
Modifié par jordane45 le 13/06/2015 à 01:53
Modifié par jordane45 le 13/06/2015 à 01:53
Bonjour,
Déjà.. ton script PHP.. tu peux l'écrire ainsi :
Cordialement,
Jordane
Déjà.. ton script PHP.. tu peux l'écrire ainsi :
<?php $exampleInputSubmit = isset($_POST['exampleInputSubmit'])?$_POST['exampleInputSubmit']:NULL; $exampleInputText = isset($_POST['exampleInputText']) && !empty($_POST['exampleInputText'])?trim($_POST['exampleInputText']):NULL; $result=array(); $return["valide"] = "Bien"; if($exampleInputSubmit){ if($exampleInputText){ $nameFile = htmlspecialchars($exampleInputText); if (preg_match('/[^A-Za-z0-9_\-]/', $nameFile)){ $return["error"] = "test du format nom"; } else { $return["valide"] = "pas de nom"; } } } echo json_encode($return); ?>
Cordialement,
Jordane
Modifié par jordane45 le 13/06/2015 à 01:53