$.ajax({
type: \"POST\", url: baseURL+\"sys/formTipi_azioni\",data:\"az_tipo=\"+azione,
beforeSend: function(){$(\"#form\").html(\'
Try this:
$.ajax({
type: "POST",
url: baseURL + "sys/formTipi_azioni",
data: { az_tipo: azione },
beforeSend: function(){
$("#form").html('<p><img src="'+baseURL+'lib/img/ajax-loader.gif" width="16" height="16" alt="loading" /><p>');
},
success: function(html){
$("#form").html(html);
}
});
and leave jQuery do the url encoding for you.
you are looking for encodeURIComponent
azione = escape(String(azione));
should be
azione = encodeURIComponent(String(azione));
or simply
azione = encodeURIComponent(azione);
escape(String(azione)).replace(new RegExp( "\\+", "g" ),"%2B");
this one sends the plus symbol with the help of regular expression
Never use escape(). Use encodeURIComponent().
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('<p><img src="'+baseURL+'lib/img/ajax-loader.gif" width="16" height="16" alt="loading" /><p>');},
success: function(html){$("#form").html(html);}
});