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

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- 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:

this part broken , I mean the msg returns blank

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

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