Jump to content


justsomeguy

Member Since 17 Apr 2006
Offline Last Active Yesterday, 09:57 PM
*****

#310399 Array index by its value (key)

Posted by justsomeguy on 01 February 2017 - 05:38 PM

You can also use this:

http://php.net/manua...rray-search.php


#310382 GeoLocation Help

Posted by justsomeguy on 31 January 2017 - 11:03 PM

No, you added that line to showLocation for some reason. I'm suggesting that you change the line in getLocation where you call navigator.geolocation.getCurrentPosition and tell it to use updateWeather as the callback function instead of showLocation, or whatever you want to name the callback. Then that callback function should do everything that you want to happen once you get the location, so it should update that element's innerHTML if you want, send an ajax request, or whatever else you want to happen after you get the location.


#309122 CSS Template Error on Apache2 Server

Posted by justsomeguy on 16 November 2016 - 05:48 PM

You have the link to the CSS file right there, you can right-click on the link and choose to save the file and then link it locally.


#309103 Selecting and retrieving Data from a MySQL Database using PHP and AJAX

Posted by justsomeguy on 15 November 2016 - 11:14 PM

No, that is node.js, that won't run in a browser. That's totally unrelated to what you're doing. You need to understand what's going on, not add random pieces of code. You're trying to use a variable that doesn't exist. "xmlhttp" is not a reserved word in Javascript, it is a variable name in your code. The variable isn't defined. I couldn't guess why you don't have it defined, other than just the fact that it's not defined where you're trying to use it, but if you show all of your code then maybe I can point it out. In the code on the w3schools tutorial they define it here:
 
        if (window.XMLHttpRequest) {
            // code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        } else {
            // code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
Maybe you decided to remove that code, maybe you changed the variable name, maybe it's in a different scope than where you're trying to set the onreadystatechange handler. I can't really guess without seeing your code.


#308614 How to Edit/Delete a post?

Posted by justsomeguy on 26 October 2016 - 11:19 PM

Considering you could post late in the day, go out, go to bed for more than six hours, seem a bit silly setting it to six hours, don't you think.

No, I don't think it's a bit silly. I do think it's a bit silly to make a post, go out, go to bed, then decide you want to edit the post. Just post a follow-up. We can come up with any hypothetical for any time period. There needs to be a line, and I've set it at 6 hours.

Can you please remove it?

Done.


#307967 Responsive drop down menu using jQuery

Posted by justsomeguy on 29 September 2016 - 10:37 PM

That might be overridden by the other rule, because the other rule has a more specific selector. You might want to use a selector like this in the CSS:

nav ul li:not(#menu) .showing

That will make it more specific and should override the other rule. If that doesn't work I would go to your browser's developer tools and inspect the elements that you're working with, you'll be able to see which CSS rules apply to them and where they're coming from.


#307964 Responsive drop down menu using jQuery

Posted by justsomeguy on 29 September 2016 - 09:55 PM

The max-height it still set to 0, changing the line-height doesn't automatically change the max-height also.


#307605 I didn't understand these bitwise operators. Plz help.....

Posted by justsomeguy on 08 September 2016 - 05:11 PM

The decimal result in the page you linked to isn't the column to pay attention to, decimal doesn't really mean much when you're dealing with binary operations. The binary result is the important one.


#307422 Unexpected T_VARIABLE on File Upload

Posted by justsomeguy on 02 September 2016 - 10:19 PM

If you want to figure out exactly what's going on, save the file that doesn't run and then use a hex editor to open it so that you can see the actual bytes in the file. There's going to be a strange byte (maybe a null byte) probably at the end of the line right before the error message.


#307415 Unexpected T_VARIABLE on File Upload

Posted by justsomeguy on 02 September 2016 - 07:39 PM

I copied the same code on that page and tested it on that site, and I got no errors. Sounds like there's an issue with you copying the code, for whatever reason. Do you have browser extensions that affect that?

Nevertheless, it's always best to type the code out yourself, that's the best way to learn and understand how everything works.


#307410 update content via eventlistener

Posted by justsomeguy on 02 September 2016 - 06:46 PM

You can also use Function.bind:

spieler[i].addEventListener("click", ReplaceContentInContainer.bind(spieler[i], "anyID"));
The first parameter to bind is the object that you want to set to this, so when that functions runs this will be set to spieler[i].

https://developer.mo...s/Function/bind


#307346 Can't Loop Through JavaScript "style" Object...

Posted by justsomeguy on 31 August 2016 - 06:18 PM

If you're trying to list all of the styles that apply to an element, then this note from the MDN page of the style property applies:

The style property is not useful for learning about the element's style in general, since it represents only the CSS declarations set in the element's inline style attribute, not those that come from style rules elsewhere, such as style rules in the <head> section, or external style sheets. To get the values of all CSS properties for an element you should use window.getComputedStyle() instead.




#307071 Using tutorials on skype

Posted by justsomeguy on 24 August 2016 - 07:47 PM

As long as you provide attribution in your teaching aids I'm sure it would be fine. They also have PDFs and other things available on the site.


#307061 How to send data in request body

Posted by justsomeguy on 23 August 2016 - 08:50 PM

You can just send data without any name/value pairs, any data you send will go in the request body. It will only get automatically parsed by something like PHP if it's in the name/value pair format.

var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = ajax_handler;
xhttp.open("POST", "script.php", true);
xhttp.send('request body here');
You may still want to URL-encode the request body. In PHP, for example, you would get the request body by reading from the php input stream.

http://php.net/manua...rappers.php.php


#305899 PHP and AJAX live search

Posted by justsomeguy on 05 August 2016 - 05:33 PM

Your form is inside a div called "livesearch", and your Javascript function clears out the contents of that div and replaces it with the search results. That's going to remove the form.