-5

I have created 2 div tags. In one of the div tags I'm having link and I want to display the result into another tag.

My code is:

<div>
  <div id="loginDiv"><a href="login.php">LogIn</a></div>
  <div id="loginPageDiv"></div>
</div>

How can I display my login page in "loginPageDiv"?

Trev
  • 1,358
  • 3
  • 16
  • 28

3 Answers3

2

try using ajax. --> http://api.jquery.com/jQuery.ajax/

for example

$('#loginDiv a').click(function(e){
  e.preventDefault();
  $.ajax({
    type: "GET",
    url: this.href,

  }).done(function( html ) {
    $("#loginPageDiv").append(html);
  });
});
0

you can use java Script (Ajax call) to acheive this

and inside ajax call you set your result to that div id

document.getElementById("loginPageDiv").innerHTML = result
someone
  • 6,577
  • 7
  • 37
  • 60
0

Using jQuery:

<script>
    $(function() {
        $('#loginDiv a').click(function() {
            $.get(this.href, function(data) {
                $('#loginPageDiv').html(data);
            });
            return false;
        });
    });
</script>
Trev
  • 1,358
  • 3
  • 16
  • 28