Skip navigation
Currently Being Moderated

Php / jquery ajax file upload

Oct 28, 2011 4:18 AM

Hi

 

I have uploaded files before but not using jquery but now am trying to use jquery so that my files uploads without page refreshing.

 

This is my Jquery code. and below is the html code. Can any one help me with the jquery code so that I can get the data to the php script that processes

he variable. This is not

 

 

<script type="text/javascript" >

$(document).ready(function() {

 

            $("#blogform").submit(function()         {

            var blogtitle = $("#blogtitle").val();

            var bloggenre = $("#bloggenre").val();

            var blogcontent = $("#blogcontent").val();

            var blogphoto = $("#blogphoto").val();

            var blogphoto2 = $("#blogphoto2").val();

            var blogweblink = $("#blogweblink").val();

 

            var dataString = 'blogtitle='+ blogtitle + 'bloggenre=' + bloggenre + 'blogcontent=' + blogcontent + 'blogphoto=' + blogphoto + 'blogphoto2=' +     blogphoto2 + 'blogweblink=' + blogweblink ;

 

            if(blogtitle=='' || bloggenre=='' || blogcontent =='' || blogphoto=='' || blogphoto2=='' || blogweblink =='')

            {

            $("#allresult").html('no');

            }

            else

            {

        $.ajax({

type: "POST",

url: "ajaxblog.php",

data: dataString,

success: function(){

$("#allresult").html('yes');

}

});

}

return false;

});

});

 

</script>

 

I get a yes at div allresults indicating validation worked but I can not
get ajaxblog.php  recieving the data.

 

/html form attributes look like this.

 

<form id="blogform" method="post" enctype="multipart/form-data" action=''>

 

</form>

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points