SyntaxError: JSON.parse: unexpected end of data at line 1 column
Résolu/Fermé
gretin
gretin
- Messages postés
- 6
- Date d'inscription
- mardi 6 mai 2014
- Statut
- Membre
- Dernière intervention
- 13 juin 2015
gretin
- Messages postés
- 6
- Date d'inscription
- mardi 6 mai 2014
- Statut
- Membre
- Dernière intervention
- 13 juin 2015
A voir également:
- Syntaxerror: json.parse: unexpected end of data at line 1 column 1 of the json data
- Json.parse: unexpected end of data at line 1 column 1 of the json data - Meilleures réponses
- Uncaught syntaxerror: json.parse: unexpected end of data at line 1 column 1 of the json data - Meilleures réponses
- Syntaxerror: json.parse: unexpected end of data at line 2 column 1 of the json data ✓ - Forum - Javascript
- Probleme JSON.parse ✓ - Forum - Javascript
- Uncaught syntaxerror: json.parse: unexpected end of data at line 1 column 1 of the json data - Forum - Javascript
- Uncaught SyntaxError: Unexpected identifier - Forum - Google Docs
- Parse error: syntax error, unexpected end of file ✓ - Forum - PHP
3 réponses
jordane45
Modifié par jordane45 le 13/06/2015 à 01:53
- Messages postés
- 36069
- Date d'inscription
- mercredi 22 octobre 2003
- Statut
- Modérateur
- Dernière intervention
- 17 août 2022
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