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
Advertisement
Associates
Associates
techtuts Darkmindz
CSS Tutorials Tutorialsphere.com - Free Online Tutorials
Boston PHP SurfnLearn
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-05-2007, 04:49 PM   #1 (permalink)
The Acquainted
Inquisitive 
 
WinSrev's Avatar
 
Join Date: Sep 2007
Posts: 133
Thanks: 6
WinSrev is on a distinguished road
Application Error Sending and Retrieving Data

Hey,

Been having a bit of a problem with my Ajax script, i have this for the link:

Code:
<a href="#" onClick="getData('revision.php?mid=3&sesion=2&user=1', 'messageContent');">
and this for the ajax side of it:

Code:
var XMLHttpRequestObject = false;

try {
	XMLHttpRequestObject = new ActiveXObject("MSXML2.XMLHTTP");
} catch(exception1) {
	try {
		XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
	} catch(exception2) {
		XMLHttpRequestObject = false;
	}
}

if (!XMLHttpRequestObject && window.XMLHttpRequest) {
	XMLHttpRequestObject = new XMLHttpRequest();
}

function getData(dataSource, divID) 
{
	if(XMLHttpRequestObject) {
		var obj = document.getElementById(divID);
		XMLHttpRequestObject.open("GET", dataSource);
		
		XMLHttpRequestObject.onreadystatechange = function()
		{
			if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
				obj.innerHTML = XMLHttpRequestObject.responseText;
			}
		}
		
		XMLHttpRequestObject.send(null);
	}
}
but nothing seems to happen? any ideas? Thanks
Send a message via ICQ to WinSrev
WinSrev is offline  
Reply With Quote
Old 12-05-2007, 05:20 PM   #2 (permalink)
The Addict
Upcoming Programmer Top Contributor 
 
Rendair's Avatar
 
Join Date: Nov 2007
Location: UK
Posts: 296
Thanks: 18
Rendair is on a distinguished road
Default

When ever i use ajax i use the following code.

PHP Code:
<script language="javascript" type="text/javascript">
<!-- 
function 
ajaxFunction(){

var 
ajaxRequest;  // The variable that makes Ajax possible!
    
    
try{
        
// Opera 8.0+, Firefox, Safari
        
ajaxRequest = new XMLHttpRequest();
    } catch (
e){
        
// Internet Explorer Browsers
        
try{
            
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (
e) {
            try{
                
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (
e){
                
// Something went wrong
                
alert("Your browser broke!");
                return 
false;
            }
        }
    }
    
// Create a function that will receive data sent from the server
    
ajaxRequest.onreadystatechange = function(){
        if(
ajaxRequest.readyState == 4){
          
document.getElementById("id").innerHTML ajaxRequest.responseText;
        }
    }
    
ajaxRequest.open("GET""process.php?id=1&id2=2"true);
    
ajaxRequest.send(null); 
}
//-->
</script> 
__________________
www.mypubquiz.co.uk - The Quiz Community - NEW QUIZZES
Send a message via MSN to Rendair
Rendair is offline  
Reply With Quote
Old 12-05-2007, 05:22 PM   #3 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 1,600
Thanks: 72
Wildhoney is on a distinguished road
Default

That works perfectly for me in Internet Explorer 7 and Mozilla Firefox 2.0.0.11 (Anyone else noticing Mozilla release lots of updates recently?).

See the attached file, try just running that on its lonesome and seeing what happens.
Attached Files
File Type: php WinSrev_Ajax.php (978 Bytes, 58 views)
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 12-05-2007, 05:34 PM   #4 (permalink)
The Acquainted
Inquisitive 
 
WinSrev's Avatar
 
Join Date: Sep 2007
Posts: 133
Thanks: 6
WinSrev is on a distinguished road
Default

Well, it's half working although here mid=3&sesion=2&user=1 for some reason it's going to the PHP script through the Ajax as mid=1&sesion=1&user=1

Any ideas?
Send a message via ICQ to WinSrev
WinSrev is offline  
Reply With Quote
Old 12-05-2007, 06:35 PM   #5 (permalink)
The Acquainted
Inquisitive 
 
WinSrev's Avatar
 
Join Date: Sep 2007
Posts: 133
Thanks: 6
WinSrev is on a distinguished road
Default

Nevermind! All fixed now !

Thanks for all the help!
Send a message via ICQ to WinSrev
WinSrev is offline  
Reply With Quote
Old 12-05-2007, 07:32 PM   #6 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 1,600
Thanks: 72
Wildhoney is on a distinguished road
Default

Care to share how you fixed it? Just in case anybody else is having a similar issue.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 12-05-2007, 07:57 PM   #7 (permalink)
The Acquainted
Inquisitive 
 
WinSrev's Avatar
 
Join Date: Sep 2007
Posts: 133
Thanks: 6
WinSrev is on a distinguished road
Default

It was actually a PHP issue, so, that Ajax code and HTML works.
Send a message via ICQ to WinSrev
WinSrev is offline  
Reply With Quote
Old 12-06-2007, 01:50 AM   #8 (permalink)
The Acquainted
Upcoming Programmer 
 
CMellor's Avatar
 
Join Date: Sep 2007
Location: Leeds, UK
Posts: 141
Thanks: 6
CMellor is on a distinguished road
Default

Pssst... use Prototype

Yeah Wildhoney, I've noticed all the Firefox updates lately...wutupwidat!? Though I'm still on .06 because of Vista, it won't let me update it for some strange buggered up reason.
__________________
Not quite a n00b...
CMellor is offline  
Reply With Quote
Old 12-06-2007, 02:19 AM   #9 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 1,600
Thanks: 72
Wildhoney is on a distinguished road
Default

Well I think Firefox is still on a slippery at the moment, it in my books anyway. The only reason I use Firefox now is because there's no Firebug available for Opera. Though I believe Opera are in the process of developing one! When comparing the 2, the speed difference these days is astonishing. It shows you how far Firefox has dropped in terms of being a light-weighty and speedy browser.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 12-06-2007, 01:32 PM   #10 (permalink)
The Acquainted
Inquisitive 
 
WinSrev's Avatar
 
Join Date: Sep 2007
Posts: 133
Thanks: 6
WinSrev is on a distinguished road
Default

Netscape is pretty awesome, and really quick, even thought it is based around FireFox they have done some work to it.
Send a message via ICQ to WinSrev
WinSrev is offline  
Reply With Quote
Old 12-06-2007, 02:40 PM   #11 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 1,600
Thanks: 72
Wildhoney is on a distinguished road
Default

Well, Netscape is based on the layout engine, not actual Firefox. Just the way it renders the elements. There are quite a few layout engines, for which every developer should have at least one browser with each layout engine to ensure their website works perfectly with it - the most popular ones, anyway:
  • Gecko (Mozilla)
  • GtkHTML (GNOME)
  • iCab (Alexander Clauss)
  • KHTML (KDE)
  • Presto (Opera)
  • Robin (Ritlabs)
  • Tasman (Microsoft)
  • Trident (Microsoft)
  • WebCore (Apple)
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 02-18-2008, 12:18 AM   #12 (permalink)
The Wanderer
 
wiifanatic's Avatar
 
Join Date: Sep 2007
Posts: 24
Thanks: 8
wiifanatic is on a distinguished road
Default

I thoght it was called WebKit:
WebKit (Apple)
wiifanatic 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


All times are GMT. The time now is 09:46 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0