0

I want to render the page when i click on particular div.

For that i written div as:

<div id="idFlip" onclick="javascript:renderPages();">
-----------content---------------------
</div>

written javascript function as:

function renderPages() 
    {
        alert("Inside");

        @RenderPage("~/Views/PP/Teacher_Observation.cshtml");    
    }

But its showing me that page while the page itself is load.(i.e. showing me both views current one and Teacher_Observation.cshtml

Its not showing me on div click.

What can i do???

Please help me.

I want to render page on click of div through javascript function

1 Answer 1

1

You could render the view on page load inside of a hidden div e.g:

<div id="idFlip">
     <div id="i-am-the-view" style="display:none">
          I am some hidden content
     </div>
</div>

And then in Javascript/jQuery:

$(document).ready(function(){
    $('#idFlip').click(function(){
         $('#i-am-the-view').toggle(); 
    });
});
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.