Jquery ajax call with '+' sign

前端 未结 6 600
时光说笑
时光说笑 2021-01-02 02:41
$.ajax({  
        type: \"POST\", url: baseURL+\"sys/formTipi_azioni\",data:\"az_tipo=\"+azione,
        beforeSend: function(){$(\"#form\").html(\'

6条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-02 03:20

    Instead of trying to compose the post data yourself, you can also let jQuery do the work by passing it an object:

    $.ajax({  
        type: "POST", url: baseURL+"sys/formTipi_azioni",
        data: {az_tipo: azione},
        beforeSend: function(){$("#form").html('

    loading

    ');}, success: function(html){$("#form").html(html);} });

提交回复
热议问题