NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Ajax, regexp, and url

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 03-18-2006, 01:34 PM THREAD STARTER               #1 (permalink)
New Member
Join Date: Jun 2005
Posts: 18
Insenic is an unknown quantity at this point
 



Ajax, regexp, and url


To save myself time, I am going to copy this from anothor forum I posted on earlier, and have so far not been able to find a solution.
????: NamePros.com http://www.namepros.com/programming/178105-ajax-regexp-and-url.html

I am working out some base code for the recoding of a site. We have deicded we want to have an available AJAX interface for users.

Now let me just say I hate Javascript. Never really have liked it. But the web is evolving and so must I.

Now we all know a problem with AJAX is the broken back button, and bookmark failure (and dirrect linking). I have attempted te fix this with the url embeded tag id's Ex a url might resemble:

http://www.site.com/#/forums/topic/1
( note the site uses mod_rewrite)

Obviously their is no tag in the page with that id. Now here is my JS to handle that urls upon loading:


var searchAddr = new RegExp(".#/(\w+/)+(\.html)?");

// Test if they want a certain page. The URL would be formed like so: http://www.mustywind..com/#/forums/topic/1

if ( searchAddr.test( window.location.href ) ) {

var start = searchAddr.lastIndex + 1; // + 1 to get rid of the pound (#) character.
var end = window.location.href.strlen() - start;

callServer(window.location.substr(start, end), 'content', false); // custom function for ajax.
}


The custom function I have there is not important. What is importang as the rest of the code, and the first paramater in that function, which is the page to load from the server.

However when I load up a page in the format of the one above, it does not work. Like I said. I hate Javascript. Not really by thing.
Insenic is offline  
Old 03-22-2006, 06:13 PM   #2 (permalink)
NamePros Member
 
Mall23's Avatar
Join Date: Oct 2005
Posts: 27
Mall23 is an unknown quantity at this point
 



I'm not sure what callServer() does, but it looks like you're trying to send a JavaScript redirect callback to the server as the script file name??? Try sending it as plain text...like
Code:
callServer("MyScript.php (replace w/ ur js string var holding the file name)", "ab=12&cd=3948", "mycustomjs");
That aught to call MyScript.php and pass in the ab and cd querystring...then when the MyScript.php is done, it'll call the mycustomjs function.
????: NamePros.com http://www.namepros.com/showthread.php?t=178105

This is all based on the assumption that your callServer works like my makeRequest...look at the ComingSoon.asp on www.fun2pic.com on line 109.
And the /Includes/ajax.js for the function details.

...the passing of the querystring is also nasty, so you have to watch that...especially foobar for international characters...omg don't get me started on that carp!
Mall23 is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 04:12 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger