CodeIgniter Forums
Ajax Form (plus image upload) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Ajax Form (plus image upload) (/showthread.php?tid=67578)



Ajax Form (plus image upload) - Princo - 03-11-2017

Hello all !

I'm making a form , With 3 fields: first name, last name, ID
Plus: profile picture

For now all good, searching on the net I learned how to upload an image with ajax

the problem is when i put in When I put these values in my JS code ( for upload image )


PHP Code:
contentTypefalse, 
processData
false

this part broken , I mean the msg returns blank

PHP Code:
$data['state'] = 'error';
$data['msg'] = validation_errors();
header('Content-type: application/json');
echo 
json_encode($data); 

in mi console whit console.log :

Object {state: "error", msg: ""}


Some way to get the message back correctly? I guess the problem is contentType.
I do not know what to do really, help

thanks for reading