Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

How to pass content in Ajax..

$
0
0

Hi

   <textarea name="txt_Description" id="txt_address"  runat="server" class="span5 wysihtml5" cols="40" rows="5" ></textarea>

1.Hi m going to pass Dscription  hi how are you but value pass to  webmethod like this hi%20how%20are%20you

take %20 for spaces..how to fix this problem

2. and i can't pass value within single quote like '  hi how are you ',suppose if m pass value like this web method wont be called

$('#btnSubmit').on('click', function () {
$.ajax({
type: 'POST',
contentType: "application/json; charset=utf-8",
url: 'ProductMaster.aspx/InsertMethod',
data: "{'Address':'" + $('#<%=txt_address.ClientID%>').val() + "'}",
async: false,
success: function (response) {
$('#btnSubmit').prop('disabled', false);
$('#btnSubmit').prop('value', 'Add New');

var result = response.d.split(",");
$('#txtID').val('');
$('#txtID').val(result[3]);
id = result[3];
if (result[0] == "Saved Sucessfully" || result[0] == "Updated Sucessfully") {

window.location.href = "ProductMasterView.aspx";

}

},
error: function ()
{ console.log('there is some error'); }
});

});

WebMethod

Public static string InsertMethod(String Address)

{

value comes like  hi%20how%20are%20you

}

thanks


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>