Link to home
Create AccountLog in
Avatar of Jyozeal
JyozealFlag for United States of America

asked on

Bundle javascript in partial view to use as widget

Hi All,

I would like to create a small widget where it contains a search box a submit button and 3 labels and 3 texboxes for displaying employee name , email, phone number. So whenever employee id is entered and upon clicking submit button I would like to make an ajax call to my controller and get the details and fill the partial view. I do not want the ajax call in main view because that will not enable me to use it in other views.

How do I achieve this? Thanks for your time.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

I am not sure what you are looking for, but you should be able to add the script reference in the parent view, and call the function in the partial view.
Avatar of Jyozeal

ASKER

Thanks for your comment. In that case I will not be able to use it as unit. My intention is to use it in various views of my project by just inserting this partial view along the with script. I do not want each view to duplicate the code to load employee details in partial view.
SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.