In my MVC application, I want to send a textarea's value to my controller. On script side in the view, seems good, but when I debug into the controller, in the given string there is only the first word
Script:
var link = "/Message/ShowConversationMessages?currUsrID=" + partA + "&bodyMsg=" + $('#msg').val();
$('#reader').load(link);
When I alert "link" variable, or "$('#msg').val()" it's perfect. eg: "This is a test message"
Controler:
public ActionResult ShowConversationMessages(long currUsrID = -1, string bodyMsg = "")
{
When I stop here, and inspect the bodyMsg value, it contains only the first word of the string: "This"
Could you please help in this? Thanks in advance
I've found the solution, the encodeURIComponent($('#msg').val()) solved it perfectly.
Thanks and regards
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.