|
... and in December, what happens?
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
I didnt get you bro. what is your concern. Will you elaborate it.
deepak.m.shrma
|
|
|
|
|
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;
try{
ajaxRequest = new XMLHttpRequest();
} catch (e){
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
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!
|
|
|
|
|
Don't reinvate a wheel. Use jQuery ajax function or something similar.
No more Mister Nice Guy... >: |
|
|
|
|
|
Thank you for your response!
But my problem is how can i do that? Can you show me how? Because i´m a newbie in javascript/ajax and i dont understand what is wrong with the code.
|
|
|
|
|
You didn't include any errors. It's been a while since I wrote any php (and I am glad... ) so it may be rusty but I don't see any obvious deficiencies.
Read this: []
It will decrease length of your code and with it maybe some bugs will disappear.
Another thing is that I don't see any reason to send client IP address back and forth (REMOTE_ADDRESS that it is for right?).
I will never change between postbacks so why are you inserting it in JS just to send it back to server?
No more Mister Nice Guy... >: |
|
|
|
|
|
|
Why you just do a service in php? And in the js make a post something like that maybe:
var DataToSend = new object();
DataToSend.name = $('#textName').val();
$.post('myservice.php',DataToSend,function(response) {
alert(response);
});
|
|
|
|
|
Hello,
I try to find a solution how to inform a user (in front of a display) that content of a web application has changed when a user has minimized a browser window (on a task bar).
My web application periodically refresh its content and I would like to inform a user if the content is changed.
Does anybody know the solution.
Thank you.
|
|
|
|
|
I would imagine a simple alert() would at least make the title bar blink in the task bar.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hello All,
I'm beginner for JavaScript, I need a script for unzip the .gzip files and gzip the any files.I created one application in HTML5 and want to merge above functionality.
Can anyone help me out!
Thanks
modified 1-Nov-12 8:32am.
|
|
|
|
|
|
for the footer i have used the concept of sticky footer.
When i increased the height of textarea instead of creating a vertical scroll bar.. it increased and hid behind the footer and when i increased further the vertical scroll bar came when it met the end of the page.
Even when i used developer tools then then footer is shifted upwards
Can someone please help me out. The demo page is up and running.
the link is http://widgetdemo.webatu.com/
-Abhishek
|
|
|
|
|
Use
{
height:auto;
}
on all parents of textarea.
And set
{
position:relative;
}
on footer.
This will cause content to stretch to textarea height.
No more Mister Nice Guy... >: |
modified 31-Oct-12 4:00am.
|
|
|
|
|
This worked like charm..
Thanks.
I have one more doubt. There is some extra space underneath the footer. And i am not able to identify where to change..
It will be great if u can help me out with it.
Thanks a lot
|
|
|
|
|
if i ll give
{ position: relative;}
for footer then it wont stick to the bottom of the page.
Its working fine with position as absolute only and
{height: auto;} on all the parents of text area.
|
|
|
|
|
Hm... Can you update your demo? Then I'll into that.
No more Mister Nice Guy... >: |
|
|
|
|
|
i think i have already updated the demo.. I checked in the developer tool there is an extra div getting added to the DOM.
This i guess is because of the hosting problem.
I tried to delete the the node from the developer tool. And then the problem went off.
Thanks
sent from mobile
|
|
|
|
|
If everything went well, then I am happy, that this help. No problem
No more Mister Nice Guy... >: |
|
|
|
|
|
Hi.. Can anyone provide some working example of calling a java webservice method(simple helloworld method) from javascript.
|
|
|
|
|
|
There are a ton of examples but I would certainly recommend using jquery[^]
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
By using Json() method we can send data to webmethod from the javascript.
|
|
|
|
|
org.mozilla.javascript.EcmaError: ReferenceError: "ActiveXObject" is not defined
Friends have encountered this kind of problem, I use ie8, Internet options security Settings for this part set I set, no, can you tell me how to solve? Please specify, thank you!
|
|
|
|
|
Say what?
Simple. You have a website that uses an ActiveX object. When you view this on your computer it is okay, you use IE8.
When your friends try to view it using FF, they get a message that says ActiveXObject isn't defined.
You wanna know why?
Easy, only (that's only, only, only or ONLY) Mirosoft Internet Explorer supports them.
There are precisely 2 options in this case:
1) Avoid using an ActiveXObject.
2) Force your friends to use IE.
I'll leave it to you to decide which is the least unpalatable..
(99%+ of the rest of the world went with option 1 btw)
Make it work. Then do it better - Andrei Straut
|
|
|
|