Click here to Skip to main content
12,348,728 members (29,294 online)

JavaScript

 
Answerto transfer items in select list to another select list without duplicates Pin
raviteja999200014-Nov-12 20:09
memberraviteja999200014-Nov-12 20:09 
QuestionHow does Yandex do its trick? Pin
Xarzu14-Nov-12 19:42
memberXarzu14-Nov-12 19:42 
AnswerRe: How does Yandex do its trick? Pin
Manfred R. Bihy14-Nov-12 20:44
mvpManfred R. Bihy14-Nov-12 20:44 
Questiondisplay record from two different time Pin
uti123fil8-Nov-12 17:15
memberuti123fil8-Nov-12 17:15 
AnswerRe: display record from two different time Pin
Richard MacCutchan8-Nov-12 23:47
mvpRichard MacCutchan8-Nov-12 23:47 
QuestionAdding a month to the current date Pin
SadiqMohammed6-Nov-12 23:48
memberSadiqMohammed6-Nov-12 23:48 
AnswerRe: Adding a month to the current date Pin
Richard Deeming7-Nov-12 2:00
memberRichard Deeming7-Nov-12 2:00 
GeneralRe: Adding a month to the current date Pin
SadiqMohammed7-Nov-12 18:31
memberSadiqMohammed7-Nov-12 18:31 
GeneralRe: Adding a month to the current date Pin
Richard Deeming8-Nov-12 2:11
memberRichard Deeming8-Nov-12 2:11 
GeneralRe: Adding a month to the current date Pin
SadiqMohammed8-Nov-12 19:08
memberSadiqMohammed8-Nov-12 19:08 
AnswerRe: Adding a month to the current date Pin
deepak.m.shrma19-Nov-12 18:07
memberdeepak.m.shrma19-Nov-12 18:07 
GeneralRe: Adding a month to the current date Pin
Peter_in_278019-Nov-12 18:58
memberPeter_in_278019-Nov-12 18:58 
GeneralRe: Adding a month to the current date Pin
deepak.m.shrma19-Nov-12 19:52
memberdeepak.m.shrma19-Nov-12 19:52 
QuestionNeed to pass object value from javascript to php Pin
gern844-Nov-12 10:08
membergern844-Nov-12 10:08 
I have a problem to pass a javascript object variable value to mysql database.
I dont really code in javascript and i dont know what is wrong.
I make an object variable. With this object i make 4 properties and then make some calculations that show some values. I need to take the results values to mysql database.
I searched in google and i found that i need ajax to do that.
But it doesnt work. I dont have experience in ajax either.
I will show you the code and hope anyone can help me

This is the Javascript 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;
			}
		}
	}
	
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			document.myForm.time.value = ajaxRequest.responseText;
		}
	}
	  <!-- Getting the end time		
      ds = new Date();
      e_time = ds.getTime();
			
      var res = new Object();
      res.bytes_transfered =document.getElementById('age').value <? echo strlen($random_string); ?>;			
      res.total_time_seconds = (e_time-s_time)/1000;
      res.generatied_in = <? echo round($stop_time - $start_time, 5); ?>;
      res.ip = "<? echo $_SERVER['REMOTE_ADDR'].' ['.gethostbyaddr($_SERVER['REMOTE_ADDR']).']'; ?>";
	 -->
 
	var queryString = "?res.bytes_transfered=" + res.bytes_transfered + "&res.total_time_seconds=" + res.total_time_seconds + "&res.generatied_in =" + res.generatied_in + "&res.ip  =" + res.ip;
	ajaxRequest.open("GET", "insert.php" + queryString, true);
	ajaxRequest.send(null); 
	 new Ajax.Request('insert.php', {
 
	onSuccess : function(xmlHTTP) {
 
        eval(mlHTTP.responseText);
    }
 
});
 
    </script>

This is the insert.php file

<?php
$fecha= date("Y-m-d H:i:s"); 
 
$connnect= mysql_connect("localhost", "root", "123456");
	mysql_select_db("dbname");
	$res.bytes_transfered= mysql_real_escape_string($_GET['res.bytes_transfered']);
	$res.total_time_seconds= mysql_real_escape_string($_GET['res.total_time_seconds']);
	$res.generatied_in= mysql_real_escape_string($_GET['res.generatied_in']);
	$res.ip= mysql_real_escape_string($_GET['res.ip']);
 
					$queryreg=mysql_query("INSERT INTO grafico(Cantidad, Tiempo, IP, Bajada, Subida) VALUES ('$res.bytes_transfered','$res.total_time_seconds','$res.generatied_in','$res.ip=','0',$fecha) ");					
					if (!$queryreg) {
					
						die('No se ha podido ingresar su registro.');
					}
					else{
					
						die("Usted se ha registrado exitosamente!");
					}
	
	?>

I hope that someone can help me!
SuggestionRe: Need to pass object value from javascript to php Pin
n.podbielski4-Nov-12 12:56
membern.podbielski4-Nov-12 12:56 
GeneralRe: Need to pass object value from javascript to php Pin
gern844-Nov-12 13:29
membergern844-Nov-12 13:29 
GeneralRe: Need to pass object value from javascript to php Pin
n.podbielski4-Nov-12 20:48
membern.podbielski4-Nov-12 20:48 
GeneralRe: Need to pass object value from javascript to php Pin
zengnanhua22-Nov-12 18:27
memberzengnanhua22-Nov-12 18:27 
GeneralRe: Need to pass object value from javascript to php Pin
Killzone DeathMan22-Nov-12 23:39
memberKillzone DeathMan22-Nov-12 23:39 
QuestionWindow restore Pin
mkotaska1-Nov-12 6:00
membermkotaska1-Nov-12 6:00 
AnswerRe: Window restore Pin
ryanb312-Nov-12 11:03
memberryanb312-Nov-12 11:03 
Questionunzip the .gzip files Pin
KIDYA31-Oct-12 19:44
memberKIDYA31-Oct-12 19:44 
AnswerRe: unzip the .gzip files Pin
Jay Zhu2-Nov-12 17:20
memberJay Zhu2-Nov-12 17:20 
Questioni have created 3 widgets using jquery ui - header, footer, textarea. i am observing abnormal behavior because of the footer widget. Pin
Abhishek Prakash30-Oct-12 5:53
memberAbhishek Prakash30-Oct-12 5:53 
AnswerRe: i have created 3 widgets using jquery ui - header, footer, textarea. i am observing abnormal behavior because of the footer widget. Pin
n.podbielski30-Oct-12 21:48
membern.podbielski30-Oct-12 21:48 
GeneralRe: i have created 3 widgets using jquery ui - header, footer, textarea. i am observing abnormal behavior because of the footer widget. Pin
Abhishek Prakash30-Oct-12 23:40
memberAbhishek Prakash30-Oct-12 23:40 
GeneralRe: i have created 3 widgets using jquery ui - header, footer, textarea. i am observing abnormal behavior because of the footer widget. Pin
Abhishek Prakash30-Oct-12 23:48
memberAbhishek Prakash30-Oct-12 23:48 
GeneralRe: i have created 3 widgets using jquery ui - header, footer, textarea. i am observing abnormal behavior because of the footer widget. Pin
n.podbielski31-Oct-12 1:50
membern.podbielski31-Oct-12 1:50 
GeneralRe: i have created 3 widgets using jquery ui - header, footer, textarea. i am observing abnormal behavior because of the footer widget. Pin
Abhishek Prakash31-Oct-12 2:44
memberAbhishek Prakash31-Oct-12 2:44 
GeneralRe: i have created 3 widgets using jquery ui - header, footer, textarea. i am observing abnormal behavior because of the footer widget. Pin
n.podbielski31-Oct-12 6:11
membern.podbielski31-Oct-12 6:11 
QuestionWorking example for Javascript to call a java webservice Pin
sekhar48429-Oct-12 23:50
membersekhar48429-Oct-12 23:50 
AnswerRe: Working example for Javascript to call a java webservice Pin
Richard MacCutchan30-Oct-12 0:54
mvpRichard MacCutchan30-Oct-12 0:54 
AnswerRe: Working example for Javascript to call a java webservice Pin
ryanb312-Nov-12 11:04
memberryanb312-Nov-12 11:04 
GeneralRe: Working example for Javascript to call a java webservice Pin
Member 946160725-Nov-12 19:32
memberMember 946160725-Nov-12 19:32 
QuestionJS::Page a serious fault Pin
lsw52131425-Oct-12 21:14
memberlsw52131425-Oct-12 21:14 
AnswerRe: JS::Page a serious fault Pin
enhzflep27-Oct-12 9:57
memberenhzflep27-Oct-12 9:57 
QuestionFill a "2D" Array with random values Pin
0bx24-Oct-12 12:27
member0bx24-Oct-12 12:27 
AnswerRe: Fill a "2D" Array with random values Pin
enhzflep26-Oct-12 20:52
memberenhzflep26-Oct-12 20:52 
QuestionFlexigrid Pin
chandra reinhart15-Oct-12 1:23
memberchandra reinhart15-Oct-12 1:23 
Questionpagination Pin
millekekez12-Oct-12 22:32
membermillekekez12-Oct-12 22:32 
QuestionProblem with IE 9 Pin
giocot11-Oct-12 7:21
membergiocot11-Oct-12 7:21 
AnswerRe: Problem with IE 9 Pin
Member 950758611-Oct-12 23:02
memberMember 950758611-Oct-12 23:02 
AnswerRe: Problem with IE 9 Pin
jkirkerx17-Oct-12 12:20
memberjkirkerx17-Oct-12 12:20 
AnswerRe: Problem with IE 9 Pin
twseitex19-Oct-12 7:39
membertwseitex19-Oct-12 7:39 
Questionwindow.open not working inside frame in google chrome. Pin
Virjin Antony10-Oct-12 1:57
memberVirjin Antony10-Oct-12 1:57 
AnswerRe: window.open not working inside frame in google chrome. Pin
twseitex19-Oct-12 8:28
membertwseitex19-Oct-12 8:28 
AnswerRe: window.open not working inside frame in google chrome. Pin
saimimtiaz28-Oct-12 8:19
membersaimimtiaz28-Oct-12 8:19 
QuestionFileUpload Inside a Gridview ItemTemplate Pin
Member 79103609-Oct-12 19:25
memberMember 79103609-Oct-12 19:25 
AnswerRe: FileUpload Inside a Gridview ItemTemplate Pin
Mohibur Rashid9-Oct-12 21:22
memberMohibur Rashid9-Oct-12 21:22 
AnswerRe: FileUpload Inside a Gridview ItemTemplate Pin
kavittrivedi16-Oct-12 2:29
memberkavittrivedi16-Oct-12 2:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 24 Jun 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid