Click here to Skip to main content
12,065,888 members (31,821 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: jQuery
hi
i have a page with dives like:

<pre lang="HTML"> 
 
                    <div id="connect" page="Conect.html" class="deskIcon">
                    </div>
                    <div id="message" page="Message.aspx"class="deskIcon">
                    </div>

and i have function with jqurey like

function creatContent(){
	Pageid++;
	var newDiv='<div class="load" id="page'+Pageid+'"><div id="top"  önclick="ThisClose('+Pageid+')"> </div><div id="content"><div id="bottom" ></div></div> </div>';
	$("#home").after(newDiv);
}
 

$("#home").find("div").live({
		click:function(){
			var addr=$(this).attr('page');
			creatContent();
			$("#content").load("Pages/"+addr);
			hideDesktop();
			addTolbar(addr,Pageid);
			}	
		});

$("#content") load the html page but it dosen't work for aspx pages how can i load a aspx page in $("#content") ?
Let's Me Explain in a image Check this img plz

http://upload.tehran98.com/img1/iszvg4aw08u9v640l7sv.png[^]
Posted 6-Jan-13 7:24am
Edited 7-Jan-13 0:32am
v3
Comments
Christian Graus 6-Jan-13 15:33pm
   
What does 'doesn't work' mean ? Have you put break points in the aspx to see if it runs ? I don't see any reason for it not to, it's still a HTTP request all the same. There is no reason I can see for this to not work.
farham_heidari 6-Jan-13 15:37pm
   
load work for content.html but it dosen't work for message.aspx
Christian Graus 6-Jan-13 16:54pm
   
*sigh* you won't get help like this. Does it crash ? Is there an error in the browser ? Does the page get requested at all ? Have you made sure the URL is correct ?

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Well, I can see two problems so far:

If you use the selector $("#content"), it means that you need to have some element to find by id="content". You don't show such HTML element in your sample. Apparently, if you don't have it, the code won't work.

Please see:
http://api.jquery.com/category/selectors/[^],
http://api.jquery.com/id-selector/[^].

The second thing depends on what do you have at the address pointed by the URL "Pages/" + addr. As you mention "load page" in the title of the question, it suggest there is a whole HTML page at this address. It cannot work, because the whole page could not be an inner HTML of HTML element. It can only work if this is a fragment of HTML, which is a valid HTML construct, so the whole thing after loading would meet the requirements defined by HTML schema.

The problem is that you don't show many of methods shown in this code fragment, so, who knows what other problems could be there?

—SA
  Permalink  
v2

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160207.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100