Object does not support this property or method in IE8

Experts,

The following code uses the .ajax() method to submit form data and works in all other browsers except IE8 because IE8 does not play nice with "new FormData()".

I've tried changing the following line from "var fd = new FormData();" to an empty array "var fd = new Array();" or "var fd = [];" but, I get the "Object does not support this property or method" error.

I've tried many iterations of this script but, I still can't get it to work. Is there a way to retrofit this script so that it can submit the form data for modern browsers and IE8?

Cheers!

<!-- BEGIN SHARE PROJECT -->
$(function(){
	$(".share").click(function() {
		var mytitle = $(this).attr("modal_title");
		var destination = $(this).attr("destination");
		$("#dialog").load(destination,null,function() {
			$("#dialog").dialog({
				title: mytitle,
				modal: true,
				width: $(window).width()-($(window).width()/2),
				height: $(window).height()-200,
				open: function(){
					$('textarea').ckeditor();
				},//END OPEN
				buttons: {
					"Send Email": function() {
						//CREATE FormData() ARRAY
						var fd = new FormData();
						//FORM VALUES FOR EVALUTION
						var a3_id = document.forms["email-form"]["a3_id"].value;
						var x = document.forms["email-form"]["recipient"].value;
						var y = document.forms["email-form"]["recipient2"].value; 
						<?php if($user==''){ ?>
							//gather senders email address
							var z=document.forms["email-form"]["sender"].value;
						<?php } ?>
						var recipient_message = CKEDITOR.instances.recipient_message.document.getBody().getChild(0).getText();
						fd.append('recipient', x);
						fd.append('recipient2', y);
						<?php if($user==''){ ?>
							fd.append('sender', z);
						<?php } ?>
						fd.append('recipient_message', recipient_message);
						fd.append('a3_id', a3_id);

						//gather recipient 1 email address
						var xatpos=x.indexOf("@mysite");
						var xdotpos=x.lastIndexOf(".org");
						//gather recipient 2 email address
						var yatpos=y.indexOf("@mysite");
						var ydotpos=y.lastIndexOf(".org");
						<?php if($user==''){ ?>
							var zatpos=z.indexOf("@mysite");
							var zdotpos=z.lastIndexOf(".org");
						<?php } ?>
						//set error variable
						var error=0;
						<?php if($user==''){ ?>
							//if sender email addresses is blank show error
							if(z=='' || z==null){
								error=1;
								alert("Please enter your email address.");
								return false;
							}//END IF
						<?php } ?>
						//if both email addresses are blank show error
						if((x=='' || x==null) && (y=='' || y==null)){
							error=1;
							alert("Please enter at least one email recipient.");
							return false;
						}//END IF
						//if email address 1 is not blank validate email address
						if(x!=''){
							if(xatpos<1 || xdotpos<xatpos+2 || xdotpos+2>=x.length){
								error=1;
								alert("Invalid email address for recipient 1.");
								return false;
							}//END IF
						}//END IF
						//if email address 2 is not blank validate email address
						if(y!=''){
							if(yatpos<1 || ydotpos<yatpos+2 || ydotpos+2>=y.length){
								error=1;
								alert("Invalid email address for recipient 2.");
								return false;
							}//END IF
						}//END IF
						<?php if($user==''){ ?>
							//if email address 2 is not blank validate email address
							if(z!=''){
								if(zatpos<1 || zdotpos<zatpos+2 || zdotpos+2>=z.length){
									error=1;
									alert("Invalid email address for sender email address.");
									return false;
								}//END IF
							}//END IF						
						<?php } ?>						
						//if no errors exist submit form			
						if(error==0){
							//POST FORM DATA AND SHOW SUCCESS MESSAGE						
							$.ajax({
								url: '../scripts/email.php?action=send',
								type: 'POST',
								data: fd,
								processData: false,
								contentType: false
							})//END .ajax()
							.done(
								//ALERT USER THAT PROJECT HAS BEEN SAVED
								function(){
									$(function() {
										$("#email_sent").dialog({								
											title: "Email Sent",
											modal: true,
											buttons: {
												Ok: function(){
													//CLOSE DIALOG IF USER PRESSES OK
													$(this).dialog('close');
												}//CLOSE OK FUNCTION
											},//CLOSE BUTTONS
											close: function(event, ui) {
												//IF USER PRESSES CLOSE BUTTON STILL REDIRECT
												$(this).dialog('close');
											}//END CLOSE FUNCTION
										});//CLOSE $submit_success
									});//END FUNCTION					
								}//END FUNCTION
							);//END .done()
						}//END IF NO ERRORS
					}//END SEND MAIL FUNCTION
				},//END BUTTONS
				close: function(event, ui) {
					$(this).dialog('close'); // remove the content
				}//END CLOSE
			});//END DIALOG
		});//END DIALOG
	});//END MODAL_LINK	
});
<!-- END SHARE PROJECT -->				

Open in new window

evibesmusicAsked:
Who is Participating?
 
Rainer JeschorCommented:
Hi,
thanks for that clarification.
Have you tried the built-in script debugger / IE DevTools to identify the exact line of the error?
You can also use e.g. IE11 and the built-in "F12 Developer Tools" and set the document mode to "8" in the emulation tab.
Then IE11 acts nearly like IE8 and you can try to track down the issue.
Sorry, I am no PHP developer therefore I can only guess what the result of the above Javascript / PHP script is.
HTH
Rainer
0
 
Rainer JeschorCommented:
Hi,
which version of jQuery have you referenced/included?
If it is a version 1.x it should work, if it is a version 2.x then it will not work in IE8, as a lot of compatibility stuff for IE8 has been removed from the library.
HTH
Rainer
0
 
evibesmusicAuthor Commented:
@Rainer Jeschor:

I am using jquery 1.11.1 and jquery ui 1.11.0.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
evibesmusicAuthor Commented:
@All:

I am unable to install IE11 in my current development environment.

@Admins: This question is still not answered. Not abandoned by me.
0
 
Rainer JeschorCommented:
Hi,
can you perhaps post the completely generated HTML / script (IE -> View source)?
Or do you have a link where we can see / test?
Thanks.
Rainer
0
 
evibesmusicAuthor Commented:
Finally able to install IE 11 which resolved this issue.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.