How to send parameters with jquery $.get()

前端 未结 4 2071
粉色の甜心
粉色の甜心 2020-12-02 22:54

I\'m trying to do a jquery GET and i want to send a parameter.

here\'s my function:

$(function() {
    var availableProductNames;
    $.get(\"manag         


        
4条回答
  •  庸人自扰
    2020-12-02 23:12

    Try this:

    $.ajax({
        type: 'get',
        url: 'manageproducts.do',
        data: 'option=1',
        success: function(data) {
    
            availableProductNames = data.split(",");
    
            alert(availableProductNames);
    
        }
    });
    

    Also You have a few errors in your sample code, not sure if that was causing the error or it was just a typo upon entering the question.

提交回复
热议问题