jamiet757 Posted March 21, 2010 Share Posted March 21, 2010 I have a script that uploads images. It uses PHP to process the images and determine if there is an error or not. I have it set up so that $error= the error message, but if $error="", $result says "Successfully Uploaded" Here is the problem: When file is uploaded, either a success icon or a failed icon appear next to the message. Here is how it is currently set up: fileComplete: function(file, response) { this.options.processResponse || this var json = $H(JSON.decode(response, true)); if (json.get('result') == 'success') { file.element.addClass('file-success'); file.info.set('html', json.get('size')); } else { file.element.addClass('file-failed'); file.info.set('html', json.get('error') || response); } }, I got rid of the JSON part on the PHP side, because it was too complicated and unnecessary for what I need it to do. I am not very familiar with javascript, but I want it to give the class of either "file-failed" or "file-success" depending on what $error is. If $error is nothing, it needs to add the class "file-success", otherwise it needs to add "file-failed". Does this make sense to anyone? I hope so. Link to comment https://forums.phpfreaks.com/topic/196057-help-with-javascript/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.