Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

ajax post body parameters

function FillData() {
    var param = $("#<%= TextBox1.ClientID %>").val();
    $("#tbDetails").append("<img src='Images/loading.gif'/>");
    $.ajax({
        type: "POST",/*method type*/
        contentType: "application/json; charset=utf-8",
        url: "Default.aspx/BindDatatable",/*Target function that will be return result*/
        data: '{"data":"' + param + '"}',/*parameter pass data is parameter name param is value */
        dataType: "json",
        success: function(data) {
               alert("Success");
            }
        },
        error: function(result) {
            alert("Error");
        }
    });   
}
Comment

ajax post variable values

$(document).ready(function(){

    // submit button click
    $("#submit").click(function(){

        var name = $("#txt_name").val();
        var email = $("#txt_email").val();
        var lang = [];

        // Initializing array with Checkbox checked values
        $("input[name='prolang']:checked").each(function(){
            lang.push(this.value);
        });

        if(email != ''){
            $.ajax({
                url: 'getData.php',
                type: 'post',
                data: {name:name,email:email,lang:lang},
                dataType: 'JSON',
                success: function(response){
                    
                    $('.details').show();

                    // selecting values from response Object
                    var name = response.name;
                    var email = response.email;
                    var lang = response.lang;
                    var foundjquery = response.foundjquery;

                    // setting values
                    $('#name').text(name);
                    $('#email').text(email);
                    $('#lang').text(lang);
                    $('#foundjquery').text(foundjquery);
                }
            });
        }
    });

});
Comment

PREVIOUS NEXT
Code Example
Javascript :: object values javascript 
Javascript :: javascript url decode online 
Javascript :: get child routes using parent in angular 
Javascript :: factorial of number js 
Javascript :: javascript check for property 
Javascript :: formdata append react js 
Javascript :: javascript create array from 1 to n 
Javascript :: livewire upload file progress indicator 
Javascript :: json merge 
Javascript :: js exec find all 
Javascript :: query selector has clas 
Javascript :: javascript remove character from string 
Javascript :: jquery visible 
Javascript :: add zero in front of numbers javascript 
Javascript :: iterate object js 
Javascript :: javascript how to check if object property exists 
Javascript :: jquery select div in div 
Javascript :: pauze js 
Javascript :: how to loop through array of numbers in javascript 
Javascript :: js array copy not reference 
Javascript :: vue max characters html input 
Javascript :: string split javascript 
Javascript :: select document jquery 
Javascript :: Convert from JSON to Python 
Javascript :: get hours and minutes and seconds from date in javascript 
Javascript :: Handle an input with React hooks 
Javascript :: vue.js textbox 
Javascript :: Tribonacci Sequence in JavaScript 
Javascript :: uuid timestamp in javascript 
Javascript :: javascript array concat spread operator 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =