Click here to Skip to main content
15,898,538 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all,

I'm trying to refresh div in other page using ajax.
Can anyone help me?

PHP
$.ajax({
                    type: "GET",
                    url: "Tree.aspx",
                    success: function(res){
                            $('#mainTree').load('');
                    });
Posted
Updated 14-Oct-10 22:02pm
v2
Comments
Dalek Dave 15-Oct-10 4:02am    
Editred for Readability

Man, There are lot more things required to do, when you get data from Server using Jquery. Have a look to the following Article.

Click here

It'll give you better Idea.
 
Share this answer
 
You can use ajax & generic handler for this purpose. generic handler is better then .aspx in this situational.

Example:

html:
<div id="divReadMore">
test test
</div>

javascript code:

var J = jQuery.noConflict();
function loadNextFiveStories() {
J.ajax({
url: "GetNextFiveStories.ashx",
type: "GET",
dataType: 'html',
data: { 'Next': '5' },
success: function (data) {
J('#divReadMore').append(data);
}
}
});
}

generic handler code:

<%@ WebHandler Language="C#" Class="GetNextFiveStories" %>

using System;
using System.Web;
using Data;
using System.Collections.Generic;

public class GetNextFiveStories : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";

context.Response.Write("New Data");
context.Response.End();
}

public bool IsReusable
{
get
{
return false;
}
}

}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900