Skip to content Skip to sidebar Skip to footer

Rewrite Javascript To Jquery With Ajax

I'm totally new to jQuery and I need to rewrite this bit of javascript to jQuery. Can you help me out? Is this correct? Javascript: var xmlHttpRequest = new XMLHttpRequest(); func

Solution 1:

Use $("#yourid") to get an element with ID yourid:

$(document).ready(function(){
    var name = $("#name").val();
    var summary = $("#summary").val();
    //blah
    $.ajax({
        url: "jsontaskmanager",
        type: "POST",
        dataType: "json",
        data: { name: name, summary: summary },
        success: function(response) {
            $("#open").html(response);
        }
    });
});

More info: http://www.w3schools.com/jquery/jquery_ref_selectors.asp

Post a Comment for "Rewrite Javascript To Jquery With Ajax"