Showing posts with label code example. Show all posts
Showing posts with label code example. Show all posts
Thursday, 8 September 2011
How to read pages with PHP and Diffbot, a visually learning robot
Friday, 29 July 2011
Fixing UTF encoding in AJAX requests on Internet Explorer
The legendary status of Internet Explorer for being special among all browsers was reminded to me when I discovered that sending a variable with non-latin character in a GET request over AJAX is apparently too troubling for IE. The result is that characters in greek are either transformed to latin ones or just disappear. This was all in a simple call like this:
[code lang="js"]$("#search_result").load("/ajaxsearch/&id=$id&f="+what);[/code]
(Where [i]what[/i] was the value of an input used in a AJAX-powered "quick search" form. Calling the same URL on a normal (non-AJAX) request everything worked perfectly.
The solution (after trying for hours to figure out what kind of transformation IE was doing on the value of the string), was simple enough: send it via POST
[code lang="js"]
$.post("/ajaxsearch/&id=$id&",{ f: what },
function(returned_data) {
$("#search_result").html(returned_data);
});[/code]
I guess since it was a input box, I should have treated the call as a form and used POST from the start, right?
[code lang="js"]$("#search_result").load("/ajaxsearch/&id=$id&f="+what);[/code]
(Where [i]what[/i] was the value of an input used in a AJAX-powered "quick search" form. Calling the same URL on a normal (non-AJAX) request everything worked perfectly.
The solution (after trying for hours to figure out what kind of transformation IE was doing on the value of the string), was simple enough: send it via POST
[code lang="js"]
$.post("/ajaxsearch/&id=$id&",{ f: what },
function(returned_data) {
$("#search_result").html(returned_data);
});[/code]
I guess since it was a input box, I should have treated the call as a form and used POST from the start, right?
Saturday, 9 July 2011
Adding OG Tags in Wordpress
I've been using the FB Connect plugin for allowing visitors to login on the blog. It adds the Open Graph tags that Facebook reads to determine how a page will be displayed on a Facebook stream when shared, but not all of them. The description and image tags are missing, plus there are not tags on the home page, only the posts. I've set out to change this.
Subscribe to:
Posts (Atom)