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 :: when does localstorage get cleared 
Javascript :: scroll element by javascript 
Javascript :: react include a polyfill webpack v5 
Javascript :: jquery remove child 1 elemtn 
Javascript :: include jsp in another jsp 
Javascript :: json javascript 
Javascript :: javascript check if is image 
Javascript :: npm uniqueid 
Javascript :: node js throw error 
Javascript :: javascript write all the prime numbers from 1 to 100 
Javascript :: jquery to br 
Javascript :: get value json python 
Javascript :: performance.now() javascript 
Javascript :: fetch in for loop javascript 
Javascript :: how to move an element of an array in javascript 
Javascript :: js number with four decimal places 
Javascript :: select all checkbox jquery 
Javascript :: android force date inside RecyclerView to re render 
Javascript :: remove underline from hyperlink react 
Javascript :: iseet jquery 
Javascript :: redux devtools chrome 
Javascript :: scrollbar automatically scroll down as new divs are added reactjs 
Javascript :: js refresh iframe 
Javascript :: vue js reload page 
Javascript :: jquery get selected dropdown item 
Javascript :: react autocomplete off for password chrome 
Javascript :: 3 = signs in javasdcript 
Javascript :: Sending an Ajax request before form submit 
Javascript :: template string javascript 
Javascript :: javascript print random word from lsit 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =