javascript ajax receive multiple values

Solutions on MaxInterview for javascript ajax receive multiple values by the best coders in the world

showing results for - "javascript ajax receive multiple values"
Mattia
11 Nov 2018
1// At the time of writing best bet is to do this:
2
3// Construct a string from your response and separate the items with a comma
4// Lets say your request sends response a string like this: '1,2'
5
6$.ajax({
7	url: '<myUrl>',
8	//data: { "id": id },
9	//async: false,
10	success: function (data) {
11		var response = data.split(",");
12		var first = response[0];
13      	var second = response[1];
14      	// ... etc.
15	}
16}