Home News Forum Articles
  Welcome back Join CF
You are here You are here: Home | Forum | Ajax Help needed.


You are currently viewing our boards as a guest which gives you limited access to view most of the discussions, articles and other free features. By joining our Virgin Media community you will have full access to all discussions, be able to view and post threads, communicate privately with other members (PM), respond to polls, upload your own images/photos, and access many other special features. Registration is fast, simple and absolutely free so please join our community today.


Welcome to Cable Forum
Go Back   Cable Forum > Computers & IT > General IT Discussion

Ajax Help needed.
Reply
 
Thread Tools
Old 24-04-2008, 11:23   #1
cf.mega poster
 
Millay's Avatar
 
Join Date: Oct 2003
Location: Portsmouth
Age: 30
Posts: 1,673
Millay has entered a golden reputation era
Millay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation era
Send a message via MSN to Millay Send a message via Yahoo to Millay
Ajax Help needed.

Hi All I have the following script and everytime I click the submit button, I get an 'object expected' error on line 66, line 66 is the submit button line.

Can anybody help me debug this, im at the stage of staring blankley at it.

Many thanks
Andy

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
function makeRequest() {

        var httpRequest;

        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            httpRequest = new XMLHttpRequest();
            if (httpRequest.overrideMimeType) {
                httpRequest.overrideMimeType('text/xml');
                // See note below about this line
            }
        } 
        else if (window.ActiveXObject) { // IE
            try {
                httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } 
                catch (e) {
                           try {
                                httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
                               } 
                             catch (e) {}
                          }
                                       }

        if (!httpRequest) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        httpRequest.onreadystatechange = function() { alertContents(httpRequest); };
        httpRequest.open('POST', 'test.asp', true);
		httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        httpRequest.send("imgfile=" + document.getElementById(‘imgfile’).value);

    }

    function alertContents(httpRequest) {

		if (httpRequest.readyState == 1) {
            var thingDisplay = document.getElementById('holiday');
			thingDisplay.innerHTML = '<b>LOADING...</b>';
            }

        if (httpRequest.readyState == 4) {
            if (httpRequest.status == 200) {
                //alert(httpRequest.responseText);
				var thingDisplay = document.getElementById('holiday');
			thingDisplay.innerHTML = httpRequest.responseText;
            } else {
				alert(httpRequest.responseText);
                //alert('There was a problem with the request.');
            }
        };
    };
</script>
</head>

<body>
<form>
  <input type="file" name="imgfile" id="imgfile">
  <INPUT TYPE="button" VALUE="Submit" onClick="makeRequest()">
</form>
<div id="holiday"></div>
</body>
</html>
Millay is offline   Reply With Quote
Old 24-04-2008, 11:26   #2
Cable Forum Team
 
Graham M's Avatar
 
Join Date: Jul 2003
Location: Poole, Dorset
Age: 23
Services: Sky+ V-Box VM 10MBit
Posts: 9,163
Graham M is a king among kingsGraham M is a king among kingsGraham M is a king among kings
Graham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kings
Send a message via ICQ to Graham M
Re: Ajax Help needed.

try putting a semi-colon after the () in the onClick statement

onClick="makeRequest();"

I remember reading somewhere that you couldn't upload images with Ayjax per se anyway
__________________
Used to be Zeph - I'm still me though
Peter: Oh my god, Brian, there's a message in my Alphabits. It says, 'Oooooo.'
Brian: Peter, those are Cheerios.
www.elitehealthdistribution.co.uk - www.loonyasylum.net
Graham M is online now   Reply With Quote
Old 24-04-2008, 11:30   #3
cf.mega poster
 
Millay's Avatar
 
Join Date: Oct 2003
Location: Portsmouth
Age: 30
Posts: 1,673
Millay has entered a golden reputation era
Millay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation era
Send a message via MSN to Millay Send a message via Yahoo to Millay
Re: Ajax Help needed.

thanks zeph, but no still object expected.

I am aware of what you are saying about ajax and uploading files, that is no strictly what im trying to acheive.

Thanks
Andy
Millay is offline   Reply With Quote
Old 24-04-2008, 11:32   #4
Eric Cartman Wannabe
 
punky's Avatar
 
Join Date: Jun 2003
Location: Cockney geeza land
Age: 27
Services: c:\> net start punky
Posts: 11,841
punky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quads
punky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quadspunky has a fine set of Quads
Re: Ajax Help needed.

Try changing:

document.getElementById(‘imgfile’).value

to

document.getElementById('imgfile').value

in case its that. If neither that or Zeph's idea works, then try putting alert statements in various places throughout the script to see at what point the script is failing.
__________________
"We're not here for a long time, we're here for a good time" - Mike Ness (Social Distortion)
"Reach for the sky, 'cause tomorrow may never come" - Reach For The Sky (Social Distortion)
punky is online now   Reply With Quote
Old 24-04-2008, 11:35   #5
cf.mega poster
 
Millay's Avatar
 
Join Date: Oct 2003
Location: Portsmouth
Age: 30
Posts: 1,673
Millay has entered a golden reputation era
Millay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation eraMillay has entered a golden reputation era
Send a message via MSN to Millay Send a message via Yahoo to Millay
Re: Ajax Help needed.

Thats cracked it thanks gavin
Millay is offline   Reply With Quote
Old 24-04-2008, 11:47   #6
Cable Forum Team
 
Graham M's Avatar
 
Join Date: Jul 2003
Location: Poole, Dorset
Age: 23
Services: Sky+ V-Box VM 10MBit
Posts: 9,163
Graham M is a king among kingsGraham M is a king among kingsGraham M is a king among kings
Graham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kings
Send a message via ICQ to Graham M
Re: Ajax Help needed.

Nicely done
__________________
Used to be Zeph - I'm still me though
Peter: Oh my god, Brian, there's a message in my Alphabits. It says, 'Oooooo.'
Brian: Peter, those are Cheerios.
www.elitehealthdistribution.co.uk - www.loonyasylum.net
Graham M is online now   Reply With Quote
Old 24-04-2008, 12:13   #7
Busy Admin
 
Paul M's Avatar
 
Join Date: Oct 2003
Location: Nottingham
Age: 45
Services: ntl Phone : Sky+ (with multiroom) : ntl Cable (20 Mbps)
Posts: 14,253
Paul M is a king among kingsPaul M is a king among kingsPaul M is a king among kingsPaul M is a king among kingsPaul M is a king among kings
Paul M is a king among kingsPaul M is a king among kingsPaul M is a king among kingsPaul M is a king among kingsPaul M is a king among kingsPaul M is a king among kingsPaul M is a king among kingsPaul M is a king among kingsPaul M is a king among kingsPaul M is a king among kingsPaul M is a king among kingsPaul M is a king among kings
Send a message via ICQ to Paul M
Re: Ajax Help needed.

Quote:
Originally Posted by Gavin View Post
Try changing:

document.getElementById(‘imgfile’).value

to

document.getElementById('imgfile').value
Am I going blind here, whats the difference between these two lines
__________________
DigiGuide Click here for a real, interactive, tv guide.
Paul M is offline   Reply With Quote
Old 24-04-2008, 12:15   #8
Anyone can play guitar
 
Mr_love_monkey's Avatar
 
Join Date: Jun 2003
Location: London way
Age: 32
Services: Women for money
Posts: 6,037
Mr_love_monkey is a king among kingsMr_love_monkey is a king among kingsMr_love_monkey is a king among kingsMr_love_monkey is a king among kingsMr_love_monkey is a king among kings
Mr_love_monkey is a king among kingsMr_love_monkey is a king among kingsMr_love_monkey is a king among kingsMr_love_monkey is a king among kingsMr_love_monkey is a king among kingsMr_love_monkey is a king among kingsMr_love_monkey is a king among kingsMr_love_monkey is a king among kings
Send a message via Yahoo to Mr_love_monkey
Re: Ajax Help needed.

Quote:
Originally Posted by Paul M View Post
Am I going blind here, whats the difference between these two lines
The types of quotes
__________________
Cheap Domain Name Registration & Reliable Hosting

If strength is born from heart ache, then mountains I could move
Mr_love_monkey is online now   Reply With Quote
Old 24-04-2008, 12:17   #9
Cable Forum Team
 
Jefferson T's Avatar
 
Join Date: Jun 2003
Location: Sandy - Bedfordshire
Age: 33
Services: 20MB, Phone, Mobile, TV
Posts: 10,681
Jefferson T is a Tri-Star memberJefferson T is a Tri-Star memberJefferson T is a Tri-Star memberJefferson T is a Tri-Star member
Jefferson T is a Tri-Star memberJefferson T is a Tri-Star memberJefferson T is a Tri-Star memberJefferson T is a Tri-Star memberJefferson T is a Tri-Star memberJefferson T is a Tri-Star memberJefferson T is a Tri-Star memberJefferson T is a Tri-Star memberJefferson T is a Tri-Star memberJefferson T is a Tri-Star memberJefferson T is a Tri-Star memberJefferson T is a Tri-Star member
Send a message via MSN to Jefferson T
Re: Ajax Help needed.

the quotation marks are different

---------- Post added at 12:17 ---------- Previous post was at 12:16 ----------

and it was only 'cos i really am going blind i noticed lol (My screen reader read both lines differently)
__________________
These are not the droids you are looking for.
Jefferson T is offline   Reply With Quote
Old 24-04-2008, 12:57   #10
Cable Forum Team
 
Graham M's Avatar
 
Join Date: Jul 2003
Location: Poole, Dorset
Age: 23
Services: Sky+ V-Box VM 10MBit
Posts: 9,163
Graham M is a king among kingsGraham M is a king among kingsGraham M is a king among kings
Graham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kingsGraham M is a king among kings
Send a message via ICQ to Graham M
Re: Ajax Help needed.



btw
__________________
Used to be Zeph - I'm still me though
Peter: Oh my god, Brian, there's a message in my Alphabits. It says, 'Oooooo.'
Brian: Peter, those are Cheerios.
www.elitehealthdistribution.co.uk - www.loonyasylum.net
Graham M is online now   Reply With Quote
Old 24-04-2008, 14:35   #11
Counteruh!!!
 
danielf's Avatar
 
Join Date: Jun 2003
Posts: 10,119
danielf is a Tri-Star memberdanielf is a Tri-Star memberdanielf is a Tri-Star memberdanielf is a Tri-Star member
danielf is a Tri-Star memberdanielf is a Tri-Star memberdanielf is a Tri-Star memberdanielf is a Tri-Star memberdanielf is a Tri-Star memberdanielf is a Tri-Star memberdanielf is a Tri-Star memberdanielf is a Tri-Star memberdanielf is a Tri-Star memberdanielf is a Tri-Star memberdanielf is a Tri-Star memberdanielf is a Tri-Star memberdanielf is a Tri-Star memberdanielf is a Tri-Star member
Re: Ajax Help needed.

Quote:
Originally Posted by Zeph View Post


btw


More like
__________________
Oh Oh Ranje
We houden allemaal van jou, de spelers en het rood wit blauw.
------------------------------------------------------------------------
I wish I knew where I was going, cause I have to get back as well.
danielf is offline   Reply With Quote
Reply


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

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

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


All times are GMT +1. The time now is 17:22.


Links
Google
 
Web www.cableforum.co.uk


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0
Copyright © 2003 - 2008, Cable Forum.
(s204569790.onlinehome.info)