www.webdeveloper.com
Results 1 to 3 of 3

Thread: Image Upload using jquery and ajax

  1. #1
    Join Date
    Jul 2012
    Posts
    12

    Image Upload using jquery and ajax

    Hi everyone, i create a simple php script to upload images it is working nice, but now i need to do it using jquery and ajax, because as i am using only php, when i send an image it redirect the page to a white page.

    well this is my simple comment system with jquery and ajax, it is simple and i tried to create some like this to image uploads but i cant use this method to image uploads,here is the code of the simple comment system, if anyone can help me with the images will be great...


    HTML Code
    PHP Code:
    <form id ="Forms" action="javascript:comments()" method="post">
                <
    textarea id="comment" 
    placeholder="Say something"></textarea>
                <
    input type="submit">
            </
    form
    JavascriptCode
    PHP Code:
    function comments() {
                
        var 
    comment = $('#comment').val();
        
        $.
    ajax({         
            
    asyncfalse,
            
    url:        'comment.php',
            
    type:       'POST',
            
    dataType:   'json',
            
    data: {
                
    comment:             $('#comment').val()
            },

            
    success:function(data) {

                $(
    "ul.#InsertThings").prepend(data);
            
            }
      
        });


    Comment.php
    PHP Code:
        $Comment = ($_POST['comment']);
     
         echo 
    json_encode(...some divs etc and $Comment inside of a div ); 
    Well it is working great, but with photos i cant use this method, i really need some help with that because i never create anything similar and really need to do it.
    I searched a lot to find some helps to my problem but cant get the best code for my problem.

    Thanks community

  2. #2
    Join Date
    Jan 2004
    Posts
    484
    I think this is what you are looking for

    http://www.9lessons.info/2011/08/aja...efreshing.html
    Natdrip :P
    "water go down the hole" - plucky duck

  3. #3
    Join Date
    Feb 2013
    Posts
    1
    Nice Tutorial Dude ................

    thanks
    <a hfref="http://androidexample.com">Example</a>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles