Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

Passing Different Variables Into WebApi2

$
0
0

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.


Viewing all articles
Browse latest Browse all 4850

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>