« first day (566 days earlier)      last day (4385 days later) » 

3:01 PM
@EventHorizon Here: pastie.org/2938683
 
@Amaan it submits an insert to the database and returns a simple echo thats all the php does
 
@Event_Horizon The echo is independent of the request data sent, correct?
 
@FlorianMargaine alexbuga.com/v8 wow
 
Yeah the echo happens if the query fails or not
 
And your problem is that this AJAX function doesn't work when using GET?
 
no the problem is it doesn't return the echo either way
 
^ speed showing innerHTML is slow.
 
Do you have a demo page set up? Maybe it's a browser thing
 
though my other AJAX (which is GET) does almost the SAME thing but it inserts value and the alert element is different
 
The PHP and the HTML pages are on the same domain, right?
 
3:05 PM
yeah
its not the browser, chrome and ff both don't get the echo back from the php
Ex: $result=sqlsrv_query($dbconnect,$query,$params); if($result) { echo "Clocked time.";} else { echo "Error."; }
 
Do they show any errors?
 
do you have error reporting enabled?
 
firebug shows the ajax to clock_insert.php in red but my other script is normal
 
ahh
 
yes error reporting is enabled
there aren't any php errors
 
3:06 PM
then what is the status of clock_insert.php
404? 500? what?
 
lemme check real quick, i don't think it says
 
0
Q: How to add javascript just before the closing body tag in the footer of WordPress

SixfootJamesI'm following some of the other people's advice here about adding my js file before the closing body tag but it doesn't seem to work for me. If someone would be so kind as to check this for me please? <?php /*load the js file into the footer*/ function myscript() { if( wp_script_is...

 
it doesn't show an error, its just red in firebug (and I know theres an issue because the echo's don't return to the page)
 
Edit your PHP page to add some logging to see if the request is received
 
21 mins ago, by TomShreds
Hey guys, I'm currently developing a web app, where do you think I should host it? I'm currently hosting all my stuff on a VPS but once it'll launch I'm afraid about scaling and I want to back myself up a bit by starting with the right service.
 
3:09 PM
hmm, not sure how I would do that
 
open chrome and look here
 
wow removeChild decimates innerHtml
 
if it's red there is a problem with it. there has to be a status.
 
@TomShreds Dreamhost is pretty nice
@rlemon It just shows a red x where the status normally is
 
Oh really? For stuff like Node.js web app?! I was thinking of something more like nodjitsu, heroku or something
 
3:10 PM
my guess is you're not accessing the page.
relative links are wrong.
 
@Event_Horizon Anything in the console?
 
How could that be if my Database insert is working
 
then the page is erroring.
500
RED generally means something happened that is not good.
 
well if I navigate to the php page itself theres no php errors
 
how is your XHR run?
can you log xhr.status and xhr.statusText;
 
3:12 PM
uhhh XHR?
 
XMLHttpRequest.
 
@Event_Horizon XHR is Ajax
 
@Amaan no , no it is not.
 
don't lie to him
AJAX is a pattern.
XHR is the interface you implement AJAX with .
 
3:13 PM
Right
Sorry
 
@EventHorizon can you post your php code?
 
well this is the gist of it if (xmlhttp.readyState==4 && xmlhttp.status==200){document.getElementById("alert").innerHTML=xmlhttp.response‌​Text;}}xmlhttp.open("POST","clock_insert.php",true);xmlhttp.send();
 
are you using a php framework like CI or Zend?
 
.. the heck is wrong with this
 
3:14 PM
can you guys see any errors? Fiddle works fine.
 
php: `session_start();include("../db_config.php");$params=array($_SESSION['userid']);$query="INSERT INTO clocked VALUES(GETDATE(),(CASE WHEN (SELECT TOP 1 clocktype FROM clocked ORDER BY dateclocked DESC)='in' THEN 'out' ELSE 'in' END),?);";$result=sqlsrv_query($dbconnect,$query,$params);
if($result){echo "Clocked time.";}else{echo "Error.";}`
 
@EventHorizon is your file structure like so
/page.html <- or whatever you're running the js on
/clock_insert.php <- look i'm in the same folder as the current level the page is loaded from
 
@Loktar Uncaught SyntaxError: Unexpected token ILLEGAL.
 
yeah.. but I dont see why..
 
its user_dash => timeclock.js => clock_insert.php all same folder
 
3:15 PM
I think you're messing with something on the page
Don't see how
Try changing the form's ID
 
ok
 
Sam
@Event_Horizon if you are using MySQL as your db, MySQL doesn't recognize select top 1; use limit 1 instead
 
i'm using sqlsrv
 
Isn't there another place where you've got to put the libraries, @Loktar?
I think there's a field.
 
Sam
ok
 
3:17 PM
Not in the prep code
 
  ui.browserscope.key = 'agt1YS1wcm9maWxlcnINCxIEVGVzdBi4wrUQDA';

  ui.add('jquery way', '\
    $(\"#formA > :checkbox[value=\'-99\']\").remove();​'
  )
  .add('purejs way', '\
    var form = document.getElementById(\"formA\");\n\
    \n\
    [].forEach.call(form.querySelectorAll(\'input[type=\"checkbox\"][value=\"-99\"]\'), function(el) {\n\
      form.removeChild(el);\n\
    });​'
  );
 
bah idk, changed all the names same error
so weird
 
why is all of that escaped?
 
I don't know
 
wtf? idk
 
3:18 PM
@Amaan I changed id didn't do a thing
 
ive never had it do any weird crap like that before..
lol I just added some (what I thought) was simple code
 
@Event_Horizon I was talking to Loktar
 
ah lol
 
@Loktar Nothing looks wrong
 
/me wonders if the [].forEach is causing issues
hmm nope
 
Sam
3:19 PM
run the same query on a different page without using AJAX, and see if you receive the proper message
 
I wonder if its from pasting it from jsfiddle
 
@sam I do, it works if you just call the php page
 
@Loktar What do you mean?
 
hah.. yup
that was it
there was some extra crap appended
 
Quotes messed up?
 
3:20 PM
I copied the code to notepad..
 
Oh
 
then deleted a weird char at the end
 
Sam
@Event_Horizon ok.....do you use relative path for the files, or absolute paths?
 
and it works now..
 
@EventHorizon ok... comment out EVERYTHING in clock_insert.php and just write die('I was here'); then tell me if you can get that back from the ajax
 
3:21 PM
Strange
 
holy shit.. its so much faster
Im really surprised actually..
 
@Loktar jsFiddle phantom character stikes again?
 
yeah
 
nice! boss just came into my office
> it's nice out... lets go home at 1
 
3:22 PM
@rlemon that doesn't work
 
@Event_Horizon then you are not accessing the page... or you are not receiving the callback data.
can you show me all of your xhr code?
 
yeah
function clock_code()
{

if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("clock_code").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","clock_code.php",true);
xmlhttp.send();
//refresh every 2 seconds
setTimeout("clock_code()",5000);
}
 
Dude!
 
php die is equivalent to exit
 
Your xmlhttprequest is global
Your other request is messing with this one is what I'm guessing
 
3:23 PM
How would I correct that?
 
At the beginning of the function, add: var xmlhttprequest;
 
Sam
the html/js files that uses that request, is it in the same folder as the php file?
 
@EventHorizon dude, you're swallowing erros... of course you wont get them.
 
Not sure what you mean @rlemon
I'm new to AJAX obviously
 
3:25 PM
//refresh every 2 seconds
setTimeout("clock_code()",5000);
5000 isn't 2 seconds
It's 5
 
lol
 
I KNOW I just haven't updated the comment
 
Haha, okay
 
More pressing matters than accurate comments when code is broke
 
Did you try adding the var xmlhttprequest;?
 
3:27 PM
yeah
to both functions right?
it causes the function that was working to error once
 
Yeah
Where are you adding it?
Add it at the beginning. To declare it
 
nevermind it must have been a one time fluke, but yes its at the beginning of the functions
 
Changes nothing?
 
not that I see no
 
Do you have a page with all your code?
Oops
Add var xmlhttp;
Not what I said earlier
 
3:30 PM
doesn't change it
theres the code
 
Sam
@Loktar asp.net controls suck!
 
:)
 
@Event_Horizon Did you try changing the var xmlhttprequest; to var xmlhttp;?
 
Sam
gives you bloated, ridiculous, useless stuff to work with
 
CSS amazes me everyday :-)
every minute :-)
every hour!
 
3:33 PM
@Amaan Yes
 
Huh.
 
CSS is nice @Abhishek
 
I made Prolog stack-overflow :(
 
Sam
CSS is the king of stuff
 
@EventHorizon please review this code... it should help you (it may actually work as is)
 
3:34 PM
@EventHorizon yeap :P
 
@Zirak It's okay, you're using it without a damned tutorial
 
@rlemon jsfiddle.net
see that with those 3d-glasses
 
Pastie doesn't even have a Prolog option ~_~
 
@rlemon the hell is that? lmao jquery everywhere!
 
3:35 PM
@Abhishek see that empty fiddle?
 
o crap (XD)
 
@Event_Horizon There's no jQuery there
 
@Event_Horizon dude... where do you see jQuery?
 
wish i could pause it for a second :-)
 
3:36 PM
@rlemon Sorry I'm a little hungover, saw the jQuery Ajax call at the bottom for some reason
 
i just named my function ajax..
it was easier than thinking.
 
@rlemon now see that ?
 
@Amaan Fix this: pastebin.com/Q3qUQnmx Pretty-print recurses to infiniteh
 
> % bitches love validation
I always love your comments.
@Abhishek yea no 3d glasses
 
@rlemon i am using my friends xps 17 kinda jumps out of screen :-)
 
3:40 PM
AHA! The 2nd pretty-print condition satisfies the condition it sets to itself in the call! Doing def fun() { fun(); other_stuff(); } is a likely cause of infinite recursion
 
@rlemon I added the else statement on here based off your code if (xmlhttp.readyState==4 && xmlhttp.status==200){document.getElementById("amessage").innerHTML=xmlhttp.respo‌​nseText;}else{console.log(xmlhttp.status + ' - ' + xmlhttp.statusText);}
 
so (hmm) with that we can make haxxy 3 dimensional screens
hmm lets do a test , somebody got 3d glasses at home ?
 
@rlemon it just shows "0 - "
 
@Event_Horizon Add xmlhttp.readyState to your console.log
 
Or perhaps console.dir(xmlhttp);
 
3:48 PM
question for you guys
0
Q: Why returning false stops propagation with jQuery while it doesn't with POJS?

Florian MargaineThe title says it all. Here is a jsfiddle using POJS showing that return false; doesn't stop the event's propagation: http://jsfiddle.net/Ralt/Lz2Pw/ Here is another using jQuery showing that return false; does stop the event's propagation: http://jsfiddle.net/Ralt/D5Mtg/ Here is the code (lon...

 
@Amaan readystate is 4
 
12
Q: HTTP status code 0 - what does this mean in MS XMLHTTP?

mike nelsonI have an HTA (Microsoft HTML application - just an offline HTML + JavaScript application) that is using the standard MS XMLHTTP COM object (Microsoft.XMLHTTP or Msxml2.XMLHTTP depending on version detected) via JavaScript code to send some data back to the server. It is returning status code ...

 
hhhmmm, xhr head request...
 
the issue is readyState is 0 before it gets the other php page I don't get it
 
//storm warning
@Amaan is it abruptly windy in bombay too ?
 
3:52 PM
Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]
 
@EventHorizon can i see your code for it ?
 
@Abhishek Nope
 
Strange , its insanely windy over here
 
Where are you?
 
//check this out:
var xhr = new XMLHttpRequest();
xhr.open( 'HEAD', '' );
xhr.addEventListener( 'load', function () { console.log( xhr.getAllResponseHeaders() ); });
xhr.send();
 
3:53 PM
Jabalpur; // home town
 
Madhya Pradesh?
 
YAY
fixed
you know what it was?
freaking button was submit and not button
that apparently causes that NS_NOERROR_CODE error in firefox
 
@Sam hi Sam :) , have you seen my email ?
 
@FlorianMargaine jQuery checks to see if the event has a been cancelled by the user.. then ensures it stays cancelled. github.com/jquery/jquery/blob/master/src/event.js#L605
 
@Event_Horizon Damn you!!
 
3:59 PM
i'm not sure excatly how or where... but after reading the event code over a few times i'm sure that is what is happening.
 
Should've looked at the HTML
 
I did post it in a pastie lmao :P
 

« first day (566 days earlier)      last day (4385 days later) »