Algolia + MVC + ajax call for searching

Hi,

I’m trying out algolia using C#.net and MVC but I can’t find any links on the best practice for implementing this in algolia.

Can you please check if I’m doing it correctly?

global asax

string json = JsonConvert.SerializeObject(userslist);
JArray batch = JArray.Parse(json);
Index index = client.InitIndex(“contacts”);
index.SetSettings(JObject.Parse(@"["“searchableAttributes”":["“first_name”","“last_name”","“email_address”"]}"));
index.AddObjects(batch);

I have a search bar here and onkeyup should do an ajax call doing the search. I saw an example where you are calling the init method in the javascript. is this necessary? Can you show me a full example of searching particularly the js side of it?

Thanks and hope to hear from you soon