How can I send an array of string from ASP.NET(C#) to javascript using the jQuery ajax technique ??
I know how to do it for a normal string, but i need to implement it with an array of string.
can I use the 'Response.Write' with an array ?? if yes, then how can I read it from the client side ?? how can i read array from there ??
this is from server side :
protected void Page_Load(object sender, EventArgs e)
{
string[] arr1 = new string[] { "one", "two", "three" };
Response.Write(arr1);
Response.End();
}
This is from the client side:
$(document).ready(function(){
$(':button').click(function(){
var text_result = "ok"
$.post('default.aspx', { text_res: text_result} , function(data){
alert("The result is: "+data);
}).error(function(){
alert("Error is occured");
});
});
});
this is not working(for array), but its working for normal data Thanks alot
text/htmlcontent type (since you're doingResponse.Write); which is not the same as returning string data to a javascript client, which typically goes back as JSON.