mrkeck Sharing the Love

13Jan/150

Make buttons act like buttons

By default, buttons are submits, so this should make them act actually like buttons

$('button').attr('type','button');
Filed under: HTML, jquery No Comments
13Jan/150

json_decode not working from database query

Short answer:

json_decode(html_entity_decode($json));

Had some JSON in a database that I wanted to use in my PHP code, but it keep coming up NULL.
Did a var_dump and the number of characters didn't match. Tried all sorts of trims and tried converting to utf8.
Ended up calling html_entity_decode() on the JSON string, then json_decode worked perfectly!

Filed under: PHP No Comments