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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.