Ajax图像上载会导致Internet Explorer中出现意外输出

I have worked around to make an ajax request for uploading a picture and I have used the below piece of code.

<form id="upload" method="post" action="upload.php" enctype="multipart/form-data">
    <input type="file" name="upl"/>
</form>

<script> // all other jquery dependencies are added for ajax file upload 
$(function(){

      $('#upload').fileupload({
      add: function (e, data) {
           var jqXHR = data.submit();    
        },
      success:function(result){
                alert(result);
     }
  });
});
</script>

My upload.php

<?php if(isset($_FILES['upl'])){
      $file = 'some random name'; // generated using rand functions in php
     if(move_uploaded_file($_FILES['upl']['tmp_name'],$file ))
        echo 'success';
      }
?>

On success I was expecting jQuery to alert success and it works perfectly fine in chrome and other browsers but when it comes to IE 7 it alerts [object Object] as output but I expect it to be success

Where did I make a mistake?

In upload.php, instead of echoing the output using

echo 'success';

you could return the JSON representation of the object using the function json_encode.

This way you can parse the json with javascript and use the parsed string in your alert. This method is cleaner than the one you are using and possibly compatible with older versions of IE (you might also need to use the JSON.stringify function to convert the parsed JSON into a string).

may be JSON object is not created in IE8 and IE7

add JSON.js file in your page