TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 08-31-2009, 11:26 PM   #1 (permalink)
The Contributor
 
Join Date: Oct 2008
Posts: 75
Thanks: 4
9three is on a distinguished road
Default AJAX call externally

Hey,

I've seen some sites that do the following:

<a href="example.php" onclick="ajax_functionname(parameter)">Example</a>

Which then that function calls an external file and does what it's suppose to do.

I'm currently using jQuery and every example is done inline. Which means people can view the source, how it functions, what page gets requested, and most importantly it means I have to go to every page with that same function and edit it page by page.

For example, in one of my pages I do this:

Code:
$.ajax({
  url: "test.html",
  cache: false,
  success: function(html){
    $("#results").append(html);
  }
});
I know that I could do $('.ajax').onclick(function () {...}) but it still shows what's happening.

How can I accomplish using this style instead?
9three is offline  
Reply With Quote
Old 09-01-2009, 05:32 AM   #2 (permalink)
The Acquainted
 
JaoudeStudios's Avatar
 
Join Date: Jul 2009
Location: Surrey
Posts: 105
Thanks: 1
JaoudeStudios is on a distinguished road
Default

To use an external file use the script tag with the src attribute - this will allow you to share js functions between pages.

However, people can still view your external js file!
__________________
JaoudeStudios.com | JaoudeStudios.com Forum | JaoudeStudios.com Blog
OpenSource is the road ahead...!
JaoudeStudios is offline  
Reply With Quote
Reply



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

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ajax Theme for CMS russellharrower Javascript, AJAX, E4X 5 07-22-2009 08:44 PM
AJAX Help CoryMathews Javascript, AJAX, E4X 9 02-25-2008 05:10 AM
Ajax without ruining crawlability? Aaron Javascript, AJAX, E4X 5 01-28-2008 06:57 PM
Ajax & Creating Thumbnail Rendair Advanced PHP Programming 0 01-10-2008 03:28 PM
Secure AJAX Server Scripts trmbne2000 General 4 12-07-2007 01:14 AM


All times are GMT. The time now is 03:22 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design