SyntaxError: JSON.parse: unexpected end of data at line 1 column
Résolu
gretin
Messages postés
6
Date d'inscription
Statut
Membre
Dernière intervention
-
gretin Messages postés 6 Date d'inscription Statut Membre Dernière intervention -
gretin Messages postés 6 Date d'inscription Statut Membre Dernière intervention -
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
- Syntaxerror: unexpected token '<' - Forum Javascript
3 réponses
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
jordane45
Messages postés
38480
Date d'inscription
Statut
Modérateur
Dernière intervention
4 746
Voir même ... sans le exempleInputSubmit .. qui me semble superflu.