¿Cómo mostrar el contenido de este enlace en la misma página usando Ajax?

I am developing an ASP.NET intranet web application which is a Quiz Engine. Since I am a new ASP.NET developer, I have a table that shows some feedback received from the users and the admin has the ability to accept or reject these feedback.

Under this table, I have a link to a new page that shows a table with the received feedback for the last three months. Instead of going to a new page, I want to show this table in the same page using Ajax but I don't know how to do that and what the name of this Ajax function.

preguntado el 10 de marzo de 12 a las 07:03

2 Respuestas

Usaría el ajax() método en jQuery.

Algo como esto

$(document).ready(function(){
$(#MyLinkID).click(function()
{
$.ajax({
  url: "feedbackpage.html",
  context: document.body,
  success: function(data){
    $('#feedbackDivID').html(data);
  }
});
}
};

respondido 10 mar '12, 07:03

You can use jquery to do it. First you need the jquery library which you can get from a CDN or just download the library.

Reference the library in the page that your using it in:

<script type="text/javascript" src="~/Scripts/jquery.1.7.min.js"></script>

In your asp page you put your link in a div tag:

<div id="loadstuffHere">
  <a href="return LoadStuff()">Click here</a>
</div>

Finally add your calling function to load the information on the page:

<script type="text/javascript">

function LoadStuff()
{
  $("#loadstuffHere").load("yourpage or callingfunction");
}

respondido 10 mar '12, 07:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.