javascript - ajax request call ending with error -


this question has answer here:

i'm having problem ajax call. want pass information on server side when call ajax request ends error. weird is, used same code, same lines, in previous project.

this ajax request (php_session_id not undefined, i'm checking every time):

$.ajax({         data: { unique: php_session_id },         url: 'server/uploading_files.php',         method: 'post',         success: function (response) {             console.log("response");          },         error: function() {             console.log("some error");         }     }); 

and uploading_files.php file:

header('content-type: application/json'); session_start();  if( isset( $_post['unique'] ) ) {$_session['unique_id'] = $_post['unique'];}  $path_to_save = 'upload/' . $_session['unique_id'] . '/'; if( !is_dir( $path_to_save ) ) {     if ( !mkdir( $path_to_save, 0777, true ) ) {         die('failed create folder uploaded photos...');     } } 

error codes when use

error: function(jqxhr, textstatus, errorthrown) {             console.log(jqxhr);             console.log(textstatus);             console.log(errorthrown);         } 

are:

jqxhr - object {readystate: 4, responsetext: "failed create folder uploaded photos...", status: 200, statustext: "ok"}

textstatus - parsererror

errorthrown - syntaxerror: unexpected token f(…)

don't have idea how solve it, please?

  1. i think it's because php return's nothing. try setup echo "something here" , how going.

  2. go network tab in chrome console , check code returned request.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -