Enter your contact information.
Enter your project information.
Step 3Choose the PHP programmers you want to hire.
Compare Free PHP Quotes
Simple AJAX Function with Example
*Attention PHP Programmers* - Add A Free Listing! Get more clients.
Below is the simple AJAX function that I use in many of my projects, TinyAjax. It makes it easy to call and process GET and POST transactions. Here are the parameters:
- URL (required)
- ID of the output element (pass a zero/false for no response output)
- String of function to be evaluated and called on completion (optional)
- Post content – example: id=22&action=1 (optional)
I will be posting more small snippets soon as well as some updates to previous scripts, new code, and tutorials. Last year was roller coaster with getting my business off the ground and it shows in my lack of time for this site. That being said, I plan to take more time to give back this year and grow my own skills so expect to see much more of me on here. I cleaned up the forums and implemented DISQUS to help everyone get the most out of this site.
On a side note, I have formed a new company this year with a partner and we are opening an office in historic downtown Franklin, TN. We will be looking for some good people to work with us so if you or anyone you know is in the Nashville area, please have them drop me a line.
TINY={};
function T$(id){return document.getElementById(id)}
TINY.ajax=function(){
return{
call:function(u,d,f,p){
var x=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
x.onreadystatechange=function(){
if(x.readyState==4&&x.status==200){
if(d){
var t=T$(d);
t.innerHTML=x.responseText
}
if(f){
var c=new Function(f); c()
}
}
};
if(p){
x.open('POST',u,true);
x.setRequestHeader('Content-type','application/x-www-form-urlencoded');
x.send(p)
}else{
x.open('GET',u,true);
x.send(null)
}
}
};
}();
A call would look something like the following:
TINY.ajax.call('get.php?id=32', 'content', 'display("red")'); // GET
TINY.ajax.call('post.php', 'content', 'display("green")', 'id=32'); // POST
Click here to download a fully working example in PHP.
Keep in mind that this will not work on your local computer unless you are running a web server like Apache. This script has been tested in all major browsers and is available free of charge for both personal or commercial projects under the creative commons license. Community support is available here.
Tue, 18 Jan 2011 03:15:09 GMT
Tags: AJAX, JavaScript,
*Attention PHP Programmers* - Add A Free Listing! Get more clients.
AJAX
JavaScript
JavaScript Fade Tutorial – Fading Elements In/Out
One of the most common JavaScript effects is fading elements and text in and out. Fortunately, it isn't very difficult to script and doesn't require a JavaScript framework.
JavaScript Slider – TinySlider 2
This full-featured and standalone JavaScript slider is easily configurable and visually customizable using CSS. It also clocks in at a tiny 3KB.
Perlman Creative Group is a Los Angeles based, full service graphic design firm specializing in marketing communication, brand development, logos, packaging, corporate identity and website design.
Marina Del Rey, California US
PHP/MySQL Developer
Zrenjanin, Vojvodina RS
Creating unique design solutions that are both affordable and inspiring. Specializing in design, layout & production of printed materials, logos & illustrations.
Rocky River, Ohio US
Thoreson Web Designs is a Wisconsin-based web design business located in Milwaukee. I have experience with an array of tools and programs, and understand the importance of project management.
Milwaukee, Wisconsin US
Technicate Solutions, Inc. is a fast-growing IT Consulting firm servicing the Sacramento area and beyond. We combine innovative technologies with business savvy to make successful projects happen.
Sacramento, California US
Firefox 4: 7 Million Downloads and Counting
With over 7 million downloads and counting, Firefox 4 looks on track to match, and possibly surpass,
Build Faster Mobile Websites With ‘Adaptive Images’
Responsive design means your website can adapt to any screen size, but without some extra help your
HTTPS Is More Secure, So Why Isn’t the Web Using It?
You wouldn’t write your username and passwords on a postcard and mail it for the world to see,
Automate and Sync Your Web With ‘If This, Then That’
The awkwardly named, but fantastically useful, Ifttt.com (short for “if this then that”)
Got Messy CSS? You’re not Alone
Woolly, the CSS sheep. You just got a new web design gig. There’s a blank CSS file staring ou
Article Tags
PHP Programmers Articles
Live Help Chat Software
Web Design Quote
Web Design