0

I have a text box which I am trying to add a "search assist" type effect onto, which displays the top then things in the list of items depending on what the user is typing, the problem is, I have a list of names in my Users model and I am trying to create the search assist in Javascript, is there an easy way to use the models in JavaScript? or perhaps there might be another way that I could look into?

1 Answer 1

1

Yes you can do it by converting your viewmodel to JSON, then use the js object.

<script type="text/javascript">

    var myJSModel= @Html.Raw(Json.Encode(myViewModel));

</script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.