« first day (2353 days earlier)      last day (2595 days later) » 

6:00 PM
can i just run an ajax timer to include a php page?
and not encode anything
 
6:14 PM
@RachelDockter timer?
 
@Shmiddty like this:

	<script>
	window.setInterval(function ajaxcall(){
				$.ajax({url: "functions/displayPostsDynamic.php",
					success: function(data)
					{
						var index;
						for (index = 0; index < data[0].length; ++index)
						{
						console.log(data[0][index]);
						}
					}
				});
			}, 6000);
	</script>
im just trying to display the data with html
 
and you have it on a timer because... it updates regularly?
 
yeh the data will change so i want it to update regularly to display any new data
 
ok
so what's the problem?
 
well the data returns ok but how would i write the data on the page in divs are stuff? i cant put any html in the script tags
 
6:17 PM
!!mdn document.createElement
 
@Shmiddty Something went on fire; status 403
 
i tried that, the page just turns white like its not responding after 6 seconds
i have the html written in a php file, would i just be able to do this: <?php include 'templates/side.php'; in some sort of timer with ajax
 
have you tried $.ajax({url: "templates/side.php", ...
 
yeh nothing happens
no errors or anything
 
6:22 PM
in your success callback, do a console.log(data)
and check your console
 
nothing logs, i dont have any json encode on that php, just html
 
then your templates/side.php is returning nothing
 
yeh its just got html code in it which i want it to display
 
also, you wouldn't want to "json encode" html
 
how would you do it? i dont have much experience
 
6:26 PM
what browser are you using, for one?
 
im on chrome
 
    $.ajax({url: "templates/side.php",
	    success: function(data) {
		    console.log(data)
		}
    });
 
@Shmiddty Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
I think I should also put a girly profile pic
 
oh this returns html as like a string
or something
 
6:29 PM
fancy that
 
now how would i get that data, to display on the page instead of console logging it
 
try googling it
 
1. The built-in [innerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML) property.
2. The jQuery .load() function.
 
@Luggage she needs to hone her google-fu
 
Note how I linked only the standard way, not the jQuery way. :)
 
6:34 PM
this is all jibberish to me i have no idea lol
im googling "ajax display html in js" am i on the right track
 
Yes, that's a good start. Also, I gave 2 more search terms that will lead to ways if doing what you want.
 
@RachelDockter read more
 
write more.... code.
 
reading is more important imho
 
lol im trying, im not a big fan of web development
 
6:37 PM
blasphemy!
 
im only doing it because of an assignment i have, i like the javascript side of it though
just not html and php and css
 
what school do you go to?
php is bad, fyi
 
id rather not say my actual school but its a university in england lol
 
ok
 
Tell them that the real world developers tell them to stop teaching jQuery.
We don't blame them, the JS world moves fast, but stop.
 
6:39 PM
HAMMERTIME!
 
Exactly.
 
halt
 
HAMMERZEIT!
 
would i just do document.write(data) ?
 
never use document.write
 
6:41 PM
True. Never use it. It isn't useful in your situation anyway.
 
its the only thing that semi works so far but ill keep looking
 
using document.write after the page is loaded will replace everything
 
yeh thats a problem
 
change your major to computer science
with a minor in mathematics
 
or drop out
 
6:43 PM
and smoke lots of weed
 
i do game design but one of the units is web design which i dont mind but 50% of that unit is this php assignment
i do already smoke too much tbh
 
please tell me you aren't going to a technical school
 
what does a technical school mean
 
is it a proper university?
 
well yeh, what other univsertiy is there lol
like an online one?
 
6:45 PM
private for-profit schools are bad
 
there are proper universities and trump oes
 
private universities have a hard time understanding what facts are...
 
well idk about that but im paying £9k a year for this one
 
that's pretty cheap
 
that's not bad
 
6:46 PM
are they accredited?
 
I paid 15k for a single semster before I dropped out
 
thats the average tuition fee in the uk
what do u mean accredited?
 
for you uk natives :P
which one?
 
would your credits transfer to another school?
if not, you should probably not go there
 
i dont wanna say the exact uni @towc but its better than average one id say, and i dont think so shmiddty
i have no plans of transfering though
 
6:47 PM
that's not the issue
the issue is that you probably won't learn anything worthwhile
 
warwick was going to charge me £21k/yr because I'm european :/
 
I made the mistake of going to for-profit schools
 
cambridge was the only one that would allow me in for £9k/yr without any doubt
 
and the teachers knew less than I did
I learned very little and have a huge amount of debt
 
others were kinda "we don't know"
 
6:48 PM
i havnt thought that far yet lol, im hoping to just get a good grade and get hired because of it and earn lots of $$$
@towc could u get into cambridge?
 
are you still in your first year?
I highly recommend checking out other unis
 
I was interviewed+pooled for CS at Queens' (arguably the hardest CS college :3 ), but then rejected
 
second, im planning on finding a placment for my third year
ah
 
if I could re-do life, I'd not slack off my senior year of HS, and apply to MIT instead of the shit schools I went to
 
got a ridiculous offer from JMC at imperial, that was fun
 
6:51 PM
you can still do MIT courses online
 
@BadgerCat that doesn't get you MIT chicks
 
@BadgerCat can you get an actual degree though?
 
I don't have the motivation I did when I was younger
 
luggage goes straight to the point
 
my life is a mess
 
6:51 PM
No, but what's important is what you know, not some certificate
 
@BadgerCat in an ideal world :)
 
No, it's getting butt.
 
^
I think luggage really was part of a dont-tell-mom club at some point
 
I'd major in CS, Mathematics, Physics, and Engineering, all at the same time
 
Tell girls you went to MIT?
 
6:52 PM
omg no way ive done it
 
MIT almost won Team Ninja Warrior
 
document.getElementById('feedDiv').innerHTML += data;
that was what i needed
 
@Shmiddty mechatronics, is what they call it today?
 
@FilipDupanović call what?
 
!!wiki Mechatronics
 
6:53 PM
Mechatronics is a multidisciplinary field of science that includes a combination of mechanical engineering, electronics, computer engineering, telecommunications engineering, systems engineering and control engineering. As technology advances, the subfields of engineering multiply and adapt. Mechatronics' aim is a design process that unifies these subfields. Originally, mechatronics just included the combination of mechanics and electronics, hence the word is a combination of mechanics and electronics; however, as technical systems have become more and more complex the definition has been broadened...
 
@Shmiddty come visit us, @ndugger is coming because his life is a mess too
 
@BadgerCat I have $0
 
"I graduated in mechatronics" sounds too much like "I spent my life watching 90s cartoons"
 
Mexico sounds like the perfect place to go to make my life an even bigger mess. Drugs, alcohol, women, beaches, alcohol
 
you said alcohol twice. You probably know that
 
6:55 PM
I'd go back to school if it were feasible
 
@Shmiddty it's some new hot shit at unis, you can kind of roll all your fantasies into 1
 
@towc I know everything
 
@BadgerCat actually, can I come visit you at some point next year? :D
 
@FilipDupanović it seems entirely too practical for me
 
Sure
But if it's next year, we might be somewhere else
 
6:56 PM
where are you headed?
 
move to SF
 
No idea
 
I'd visit there all the time
 
back to germany?
 
STOP MOVING SO OFTEN
 
6:57 PM
ndugger doesn't like change
you're traumatizing him
if he grows up to be a failure that works at target, you're the people to blame
 
@Shmiddty do you go very often to SF?
@towc No, something like Thailand
 
@BadgerCat I've only been once, but I loved it there.
 
Move to Minnesota
 
I'm not very keen on moving to the US right now
 
pls
 
6:58 PM
fair enough
the US is in a sorry state
 
50 of them.
 
51 if you count Puerto Rico
 
you're on a roll today luggage
 
It's not a state
 
what'd you put in your veins?
 
6:59 PM
they're trying to be
 
all the benefits, none of the taxes
lucky bastards
 
3 cocaines
 
Hey, would someone care to explain some JS code to a programming noob ?:D
 
that's a lot of cocaines
 
@RobertRoss Welcome to the JavaScript chat! Please review the room rules. Pleasedon't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
6:59 PM
I injected 7 marijuanas into my toenails
 
@RobertRoss try us
 
seven whole marijuans?
 
Were they Grande or Venti?
 
that's what the man said. seven.
 
@towc I thought it was a drunk >
 
7:01 PM
your a drunk >
 
@Shmiddty drunk? I think it looks a little high
 
well, it is quite a lot of code @towc momondo.com/content/programmes/flightwidget when you put the destinations some code is generated.
 
settin 'em up and knockin 'em down!
 
@towc i am just interested to learn how it all works
 
@RobertRoss are you asking about the widget code, or the code of the site?
 
7:03 PM
@Shmiddty the widget
 
that's not a lot of code, man
 
jelly beans are delicious, but god help you if you eat them in the wrong order
 
well, alright :D
 
the widget loads an external script, and has some data the the script uses to build the layout
 
I'm not a fan of jelly beans
 
7:06 PM
you jelly?
 
see, other candies get boring, but jelly beans keep changing flavor
 
candy is for children
 
I wish they were like sour patch kid texture, but
 
I'm not big on sweets; I'll usually eat fruit before I even think about candy
 
what about cookies?
 
7:09 PM
@Shmiddty ok, so the part that loads the script, is it the last one, with the scr["src"], or?
 
fruit and sugar-free energy drinks, because I'm a square
 
cookies !== candy
 
I just remembered I forgot to buy tea :( :(
 
cookies and brownies are the best
 
@Shmiddty that's why i have to ask...
 
7:10 PM
@RobertRoss the last section of code creates a script element. The script is loaded when it is put in the page
candy is mostly sugar
 
almost entirely, it's pretty fun to make
 
@ssube it's basically chemistry
 
heat sugar. done.
add more sugar for taste
 
it's very precise
 
want caramel? heat sugar more.
 
7:13 PM
then add bleach
 
caramel is complicated, it takes butter and milk
but if you have special butter, you can make a whole sheet of caramel
 
cotton candy? heat sugar while spinning
 
add blue
 
then add bleach
 
7:17 PM
then add cyanide
so I think the world needs a cataclysm
then maybe people will stop fighting eachother
 
I think people would kill eachother more
 
nope
 
survival and all that
 
seealso: mad max
 
the other option is total extinction. I'd be fine with that too
 
7:18 PM
Humans are a disease
 
^
 
ok agent smith
 
I wish
 
also, maybe this is all just a simulation
 
This is exactly what the world needs. More people contemplating terrorism.
 
7:20 PM
the whole "simulation" hypothesis is just nonsense
 
@ndugger why's that?
 
because I said so
 
well that settles it
 
glad you agree
 
so this is all just my dream, then? I'm in a coma?
 
7:21 PM
no, life just really is shitty, and everyone sucks
reality is stupid
 
oh so this is hell, then? Life is eternal torment?
 
Thankfully life isn't eternal
 
you don't know that
 
27 mins ago, by ndugger
@towc I know everything
 
Is there a spirit/soul?
Is free will an illusion?
 
7:23 PM
Doesn't matter, doesn't matter
 
@Shmiddty sounds like solipsism
 
@FilipDupanović prove it wrong ;)
 
@ndugger So, you do know that you don't know everything.
 
@littlepootis no
you can't "know" things that aren't true
 
booooooooo
 
7:25 PM
you can pretend
that would have been flagged so hard
 
!!afk CS:GO
 
is there any reason that when i do an ajax call to a php file, it wont read the session in that php file?
i tried googling it but people are saying it does read it but for me it simply doesnt
oh im an idiot nevermind
 
You didn't start the session? @RachelDockter
 
exacly lol
 
Lol
 
7:34 PM
@Alesana do u remember yesterday or the day before when u was hepling me with the ajax call i finall got it working
 
Ahh congrats
You redid everything?
 
no it was actually alot more simpler than that, i didnt have to change anything, i just added this to the homepage

	<script>
		window.setInterval(function ajaxcall(){	<!-- dynamicly update the posts using ajax on a 6 second timer -->
								$.ajax({url: "functions/displayUserPosts.php",
								success: function(data) {
								document.getElementById('feedUserDiv').innerHTML = data;
								}
								});
								}, 5000);
	</script>
jesus that formatting
 
Hahaha
 
but yeh u get the idea
 
Yeah that works
Usually it's good practice to have the JS format the JSON into HTML but that would be too much in your case lol
 
7:38 PM
yeh i actually spent like 4 hours converting it all to an array and then encoding that and trying to do all the html again inside the js
glad i didnt persue that
 
returning html in an ajax call is so gross
 
hopefully my professor wont think so lol
 
Hi everyone,
 
@gandhi_rahul Welcome to the JavaScript chat! Please review the room rules. Pleasedon't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
so when i hand it in, i have to include a php file which will create a database and fill it with test data, i wonder if i put a query to drop every database hes got on his sql, he will check it before he runs it
 
7:45 PM
Good way to get an F lol
Do you have access to any other database than yours?
 
with php u can access every other database on that machine im sure
 
can we access response headers in javascript ?
 
some headers, there's a whitelist in the spec
 
of course
 
I wanted to check for the authentication of the user. I am using token based authentication where the backend sets the authentication header on log-in.

But now on next request, I am not sure how to decide if user is logged in or not.

Any headsup would be appriciated.
*Using jQuery with express handlebars server-side.
 
7:57 PM
Hi guys
 
@tholo Welcome to the JavaScript chat! Please review the room rules. Pleasedon't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
8:17 PM
Would anyone know why if I click on a link shortly after it is set from display:none; to display:block; via JS it fires the onclick event but it doesn't open the link?
 
@Alesana, please post the full code. Thanks.
 
It's a lot of code o.o
 
Well, post only the part that is needed.
 
I will try to reproduce the problem in a jsfiddle
 
ok
 
8:33 PM
If you click a link, it hides the links and shows 1 link that will then again show the links
but if you click the link that shows links then very quickly click again on one of the recently shown links, it will complete the onclick action but it will not open the link
 
works for me everytime.
in Chrome
 
Hmm I am in chrome
Hold on..
 
It's opening links as it should..
and I see no reason why it shouldn't, code is working fine.
 
Here is what is happening to me
Just in case I didn't explain it well haha
If I click rapidly, it doesn't open it, but if I wait a small amount of time it does
That isn't happening for you guys?
 
Strange. No
wait 1 min
 
8:41 PM
Hmm I guess it's a non-problem then
That's a relief in one way, an annoyance in the other
 
You should check for propagation
just in case
 
It even happens on a different computer I tried it on
 
user7442629
Which would be easier to learn, PHP or JavaScript, with knowledge of Python, C#, C++, and Java?
 
@Aleksbgbg Welcome to the JavaScript chat! Please review the room rules. Pleasedon't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
e.preventDefault; just in case
Alesana
@Aleksbgbg, PHP
 
user7442629
8:48 PM
Alright, thanks, guess I'll do PHP then JavaScript then :)
 
@tholo to prevent it from opening the window? Or for debugging?
 
both :)
 
But how would I debug from there? It successfully doesn't open the window lol
And when I log the event to the console I can't find any differences in the object from when it doesn't and doesn't open. Odd. I am not going to worry about it though
 
9:08 PM
If I want to communicate today's date from PHP to JS should I just include a hidden input in my template with today's date so all of the pages can access it? That seems more efficient than an Ajax call
 
Chrome is clearing my cookies on refresh... what the eff
 
I've had that happen before somehow with a setting
can't remember how though now..
 
It's only on my localhost that I'm developing... I must be doing something wrong, but I have no idea
Huh, it's not just chrome. It's definitely me, then
I was using localStorage for my session id, since all rendering is done client-side, but I need to secure my admin/config pages, and I can only do that my using a cookie now instead
but It's been so long since I've used cookies
I think it has to do with me not setting an expiration
nope, that's not it...
hmmm
It's being saved on the server, so I think it's the httponly thing, but I don't know how to turn it off. MDN doesn't have any good content on it
 
9:53 PM
can I ask a question about promises
 
sure :)
 
1 message moved to Trash can
@nonerth Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
1 message moved to Trash can
@nonerth Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
keep trying :)
we believe in you
 
:p
sorry man I'll go to paste bin :p am a failure
okay let me say at first that every function query gets called with callback, the question is how to make this function run the for's in the correct order from top to bottom
add
 
1 message moved to Trash can
@nonerth Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
10:02 PM
wrap each for in a promise.resolve
 
10:12 PM
@towc are you still here buddy?
 
I'm always here
your code is still unformatted
 
hah
 
and I'm not going to be the one who'll find your solution
but ask anyway
 
I provided a link above to hastebin
 
10:27 PM
uhm soo
 
get_items_from_db sounds asynchronous
what dat?
 
every query made from DB is in a callback so, its not async
simply put it, callbacks dont prevent my rest of the code running, I want to prevent it
 
10:47 PM
heh once one part of your code base is async, you will quickly find that it cause a lot of other things to be async
wrap each for loop inside a function which returns a promise
hmm each get_items_from_db might have to return a promise as well and then you can return a Promise.all to wrap them all
 
hmm ok thank you!
 
don't forget to resolve the promises when you actually get the result from the db though
then you can just chain them all up as thenables
 
yy :)
 
λλ :)
 

« first day (2353 days earlier)      last day (2595 days later) »