Currently, I am utilizing this method to transmit data to the server through a GET request.
var val = {
name: "abcd",
age: "21"
}
var val2 = "test2";
http://server-name/getdata.htm?data=JSON.stringify(val)&data1=val2
.
Everything is functioning correctly; however, issues arise when the value of val.name contains special characters such as "abcd&def," which causes the format of the request to distort due to the inclusion of "&".
How can I address this problem effectively?