5 Replies - 5521 Views - Last Post: 08 December 2012 - 01:22 PM

#1 dardime  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 09-February 11

Javascript to fetch data on database

Posted 08 December 2012 - 07:20 AM

Hi i have created a javascript to fetch data from database unfortunately it is not working on Internet Explorer browser but it works for Firefox, Chrom, Safari.

<script type="text/javascript">
function fetchModel(manufacturer,type) {
var models = new Array();
var list  = manufacturer.selectedIndex;
var selected = manufacturer.options[list].value;

models[0] = "<option value='0'>Select&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>";
<?php
foreach($CarModels as $key => $val) {
	echo 'models['.$key.'] = "<option value=\'0\'>Select&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>";';
	
	foreach($val as $model) {		
		echo 'models['.$key.'] = models['.$key.'] + "<option value=\''.$model["model_id"].'\'>'.$model["model_name"].'</option>";  ';		
	}
}
?>
	//alert(models[selected]);
	//alert(type);
	if(type=="new") {
		document.getElementById("new_model_id").innerHTML = models[selected];
	}
	else{
		document.getElementById("model_id").innerHTML = models[selected];
	}
}
</script>



Is This A Good Question/Topic? 0
  • +

Replies To: Javascript to fetch data on database

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6079
  • View blog
  • Posts: 23,550
  • Joined: 23-August 08

Re: Javascript to fetch data on database

Posted 08 December 2012 - 07:36 AM

Define "not working".
Was This Post Helpful? 0
  • +
  • -

#3 dardime  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 09-February 11

Re: Javascript to fetch data on database

Posted 08 December 2012 - 07:43 AM

View PostJackOfAllTrades, on 08 December 2012 - 07:36 AM, said:

Define "not working".


the script is not working.

Here is the site: http://www.mondialbh.com
When you Select Car, It will automatically fetch Model list from database. On Internet Explorer it will not fetch or working.

Thanks
Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3555
  • View blog
  • Posts: 10,335
  • Joined: 08-June 10

Re: Javascript to fetch data on database

Posted 08 December 2012 - 08:09 AM

View Postdardime, on 08 December 2012 - 03:20 PM, said:

Hi i have created a javascript to fetch data from database

I can assure you that Java​Script doesn’t fetch anything from your database. instead PHP prefetches all types and prints it into the JS function body. a small but critical detail.

hence I suspect that IE has some problem getting the selected value. I’d try if manufacturer.value works.
Was This Post Helpful? 1
  • +
  • -

#5 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5364
  • View blog
  • Posts: 27,325
  • Joined: 10-May 07

Re: Javascript to fetch data on database

Posted 08 December 2012 - 08:36 AM

View Postdardime, on 08 December 2012 - 09:43 AM, said:

View PostJackOfAllTrades, on 08 December 2012 - 07:36 AM, said:

Define "not working".


the script is not working.

Stellar.
Was This Post Helpful? 1
  • +
  • -

#6 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6079
  • View blog
  • Posts: 23,550
  • Joined: 23-August 08

Re: Javascript to fetch data on database

Posted 08 December 2012 - 01:22 PM

View Postdardime, on 08 December 2012 - 09:43 AM, said:

View PostJackOfAllTrades, on 08 December 2012 - 07:36 AM, said:

Define "not working".


the script is not working.

Here is the site: http://www.mondialbh.com
When you Select Car, It will automatically fetch Model list from database. On Internet Explorer it will not fetch or working.

Thanks


Yeah, but see...not everyone USES WINDOWS. I and many other developers use Mac OS X or Linux. There is NO OPTION for using IE in those cases, unless you have Windows running in a VM on your system or in the cloud (which I'm actually sure many web developers do, I just can't be bothered for the most part). And besides that...you didn't bother to mention WHAT VERSION of IE you're experiencing this with! The different versions of IE vary wildly in their support for different web technologies.

Please read this excellent blog post from Curtis Rutland before you post on this or any other forum again so that you may be able to get prompt, accurate help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1