Hello everyone and thanks for your help in advance. I want to develop a search api to populate a jquery autocomplete widget that will be used across a number of pages in my application. The function will allow the user to search by First Name, Last Name, or Date of Birth. For simplicity, I would like to roll this all into one function, but am not sure how to do this. If I were to query to a web page, the jQuery code would look like:
switch (clickedelem) { case 'txtSrchPatientLastName': var searchUrl = "PatientSearch.aspx?LastName="; minimumlgth = 2; break; case 'txtSrchPatientFirstName': var searchUrl = "PatientSearch.aspx?FirstName="; minimumlgth = 2; break; case 'txtSrchPatientDOB': var searchUrl = "PatientSearch.aspx?PatientDOB="; minimumlgth = 5; break; }
Obviously, I am passing the field to search by in the querystring. However, I am not sure how to do this with an api call. I guess I could split the functions up, but seems to make more sense to keep them together in a logical unit. Any help would be appreciated.