Though really I'm not sure why you need javascript at all for this particular application. It would be much easier to just ditch the javascript, and code straight standards compliance. You would lose nothing, since the javascript you're proposing adds nothing. (unless I'm misunderstanding, you're using javascript to replicate the functionality of a link? Why?) This is coming from someone who loves javascript. Nevertheless, here's how I'd do it:
modify the php script to take a url ? parameter called something like "ahah". When the parameter is not present, render the whole page, with the template and everything, along with the appropriate content from the provided page number. When ahah is set to true, render the content without the template, for the benefit of the javascript. Code the javascript so it attaches the appropriate javascript function call to the onclick of the "next page" link, and remember to return false from that function to suppress the natural link behavior. In the function call the javascript is to pass the "ahah" parameter set to "true" when it retrieves the results of the php script. Then the php script would render without the template, in a format that you can easily insert into the dom of the current page. Then use a JS library called "Really Simple History" to push in a new history state for that state change. That way you're not breaking the back button or the bookmark button. Remember also to code your javascript to save its state in a hash, that is the part of the URL that comes after "#", which is accessable from window.location.hash. Really Simple History will probably help you do that. On Wed, Jul 23, 2008 at 7:27 AM, Michael Horowitz <[EMAIL PROTECTED]> wrote: > So here is a question. Was recently fixing some errors on a site I took > over. We have a page that produces a list of accounts and limits it to x > number of people per page. Then we have another form element that chooses > which page of data we view. Javascript is used so when we change the > element from page 1 to page 2 it calls a php script that does a new query > for the next x number of people and displays the results on that page. In > this case its an intranet app so I know everyone will have a mouse and > javascript enabled but how would you code if you wanted to go to web > standards and have a fallback. > > -- > Michael Horowitz > Your Computer Consultant > http://yourcomputerconsultant.com > 561-394-9079 > > > > ******************************************************************* > List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm > Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm > Help: [EMAIL PROTECTED] > ******************************************************************* > > ******************************************************************* List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm Help: [EMAIL PROTECTED] *******************************************************************
