Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery post json example

<script type="text/javascript">
    function send() {
        var person = {
            name: $("#id-name").val(),
            address:$("#id-address").val(),
            phone:$("#id-phone").val()
        }

        $('#target').html('sending..');

        $.ajax({
            url: '/test/PersonSubmit',
            type: 'post',
            dataType: 'json',
            contentType: 'application/json',
            success: function (data) {
                $('#target').html(data.msg);
            },
            data: JSON.stringify(person)
        });
    }
</script>
Comment

jquery post with json response

$.post(
    "test.php",
    { id: product_id, "images[]": jQuery.makeArray(image_links) },
    function(data) {
        var response = jQuery.parseJSON(data);

        var images = response.images[0];
        for (var i in images){
            alert(images[i]);
        }
    }
);
Comment

jquery post with json response

$.post(
    "test.php",
    { id: product_id, "images[]": jQuery.makeArray(image_links) },
    function(data) {
        var response = jQuery.parseJSON(data);

        var images = response.images[0];
        for (var i in images){
            alert(images[i]);
        }
    }
);
Comment

PREVIOUS NEXT
Code Example
Javascript :: show and hide div tag based on checkbox selection using jquery 
Javascript :: js string only positive float numbers 
Javascript :: react chartjs size 
Javascript :: check if is array js 
Javascript :: remove all from array that matches 
Javascript :: firstElementChild jquery equivalent 
Javascript :: cypress set viewport 
Javascript :: adding event on enter key keypress in javascript 
Javascript :: how to remove last char from string in javascript 
Javascript :: jquery each has class 
Javascript :: js get mouseclick 
Javascript :: parseint array javascript 
Javascript :: js regex domain name 
Javascript :: multer file type validation 
Javascript :: hide button using javascript 
Javascript :: js change root css variable 
Javascript :: yarn create strapi-app 
Javascript :: javascript get text between two words 
Javascript :: regex for numbers + dot in javascript 
Javascript :: get query param javascript 
Javascript :: pagecontrol 
Javascript :: jquery get src of image 
Javascript :: javascript queryselector data attribute 
Javascript :: byte to gb javascript 
Javascript :: javascript timestamp to relative time 
Javascript :: react native textinput turnoff capitalize first letter 
Javascript :: how to get iso date with moment 
Javascript :: send a message when a bot joins your server discord.js 
Javascript :: flutter decoration image 
Javascript :: javascript reference file two folders up 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =