Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi Im trying to send data to the server using JQuery. The user was present optio

ID: 3555107 • Letter: H

Question

Hi Im trying to send data to the server using JQuery. The user was present options to choose from using radio buttons. Once the user has chosen their choice they click submit and their data should be send to server using Ajax too. Problem is that I cant figure out what Im doing wrong. Here is the JQuery part. Any help would be nice.

$("document").ready( function(){
   $("#GetValue").click( function(){
    
   var selValue = $('input[name=band]:checked').val();
      
       $.ajax( {
      
           url: "voteband_ajax.php",
           type: "POST",
           data: "band=" + selValue,
           success: function( msg ){
           $("#votedivwrap").hide( );
           $("#votedivwrap").html( msg );
           $("#votedivwrap").show("fade",1000);
          
          
           }//ends success code
      
       });//ends ajax
   });//ends click handler

});//ends document.ready

Explanation / Answer

Please try the following:


$("document").ready( function(){
$("#GetValue").click( function(){
  
var selValue = $('input[name=band]:checked').val();
  
$.ajax( {
  
url: "voteband_ajax.php",
type: "POST",
   dataType: 'json',
data:
   {     
       band: selValue
   }  
   success: function( msg ){
   $("#votedivwrap").hide( );
   $("#votedivwrap").html( msg );
   $("#votedivwrap").show("fade",1000);
  
  
}//ends success code
  
});//ends ajax
});//ends click handler

});//ends document.ready

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote