Horje
js object to c# object Code Example
js object to c# object
// Construct a object in JS

var obj = {
  id: 0 ,
  userName: 'Bill'
};

// C# class:

public class myClass
{
  public int id;
  public string userName;
}

// Then for example using AJAX send your data to C#,
// and deserialize, when you need work with object

$.ajax({
	type: "POST",
  	// Note that you need to pass the method as url
	url: '<your server url>' + 'DeserializeObject',
  	// your data is the object you want to send
	data: obj,
	contentType: "application/text; charset=utf-8",
	dataType: "text"
})

[HttpPost]
public void DeserializeObject(string objJson)
{
var obj = (new JavascriptSerializer()).Deserialize<myClass>(objJson);
}




Javascript

Related
Create calculator calling different operators with functions in javascript Code Example Create calculator calling different operators with functions in javascript Code Example
html import javascript Code Example html import javascript Code Example
self excuting arrow function Code Example self excuting arrow function Code Example
sweetalert jquery Code Example sweetalert jquery Code Example
else if in javascript Code Example else if in javascript Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8