2

imple ajax upload , want to know how to implement it in my code ... I have searched lot of uploader not know how to implement it in my code.

$('#message_form').html('Profile Information Edit'+ ''+ ''+ 'First Name :'+ 'Last Name :'+ 'E- Mail :'+ 'Photo :'+ ''+ ''+ 'Gibs Owned:'+ '' );

MessageWindow.show();
$(".cancel").click(function() {

    MessageWindow.hide();
});
$(".submit").click(function() {
    ajaxFileUpload();
    var dataString = $("#myform").serialize();
    $.ajax({
        type: "POST",
        url: YAPI.baseUrl+"updateuser.php",
        data: dataString,
        success: function(data){
            response = eval('('+data+')');
            alert(response.message);
            YAPI.execute({command:'getuser',userid:App.currentUser.getData('userid')},
                function(response,data){
                    //App.currentUser.setData();
                }
            );

            MessageWindow.hide();
        }
    });
    return false;
});
XMen
  • 29,384
  • 41
  • 99
  • 151
  • You are showing a lot of badly-structured code that is very hard to understand. I doubt anybody will be able (and willing) to fix or change this code for you, especially seeing that you're not giving any real information. – Pekka Sep 08 '10 at 11:48
  • 1
    http://stackoverflow.com/questions/3666921/easiest-way-to-make-a-form-submit-without-refresh/3666981#3666981 Take a look at pekka's comment on that post. – RobertPitt Sep 08 '10 at 11:48
  • i have html in the code that i am not able to show here in code block – XMen Sep 08 '10 at 12:01
  • $('#message_form').html('Profile Information Edit'+ '
    '+ ''+ ''+ ''+ '
    First Name :
    Last Name :
    E- Mail :'+
    – XMen Sep 08 '10 at 12:02
  • 'Photo :'+ ''+ ''+ 'Gibs Owned:
    '+ '' );
    – XMen Sep 08 '10 at 12:02
  • 1
    @Rahul did you read @Robert's comment? Also, adding even more code is not going to improve your question... – Pekka Sep 08 '10 at 12:10
  • @Rahul That is definitely not the best way to insert in HTML dynamically. Either have that HTML fragment hidden on your page, then unhide it when needed, or build your way up the form with separate DOM insertions. Putting a giant chunk of HTML into your Javascript is just wrong. – Yi Jiang Sep 08 '10 at 12:11
  • @all tell me the solution na how can i do this .... – XMen Sep 08 '10 at 12:16

1 Answers1

0

If possible, try to use jQuery plugins like Uploadify. Also, check this for more info:
Asynchronous file upload (AJAX file upload) using jsp and javascript

Community
  • 1
  • 1
Sidharth Panwar
  • 4,606
  • 6
  • 27
  • 36