Marko
Marko

Reputation: 57

Load external html content with jquery - with latin extended characters

I have small jquery script which allows me to load external html content by clicking to Li element which has ID equal such as part of content in HTML file which is loaded into specific div as result but I have problems with encoding (extended latin characters). Does anyone knows how to solve this problem.

Below is link on non-working JSFiddle because i can`t load contents in JSFiddle from my server but everything is there.

Here is JSFiDDLE: http://jsfiddle.net/QQz5W/

Part of code which missing from fiddle is actually html file which need to be loaded and which contains text with latin extended characters.

Here is that part:

 <div id="section_first">
        <div class="LeftDiv">
            <h2>Opći uvjeti za montiranje drvenih podnih obloga</h2>
        </div>

            <h3>1. PRIJE POLAGANJA</h3>
            <p><b>1.1. Dozvoljena vlažnost podloge:</b><br>
            - cementna košuljica do 2,0%, cementna košuljica s podnim grijanjem do 1,8%<br>
            - anhidridna košuljica do 0,5%, anhidridna košuljica s podnim grijanjem do 0,3%<br>
            - ploče od iverice 9+4% / 8+2%</p>
    </div>
<div id="section_second">
        <div class="LeftDiv">
            <h2>Title</h2>
        </div>
<p><b>bla bla čćšđž ČĆŽŠĐ</b></p>
    </div>

I`ve tried to add

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="hr" http-equiv="Content-Language" />
</head>

to that html file but it seems that this part is ignored on load.

Upvotes: 0

Views: 735

Answers (1)

see613
see613

Reputation: 494

to loading content (try utf-8 or ISO-8859-1):

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

and

$.ajax({
    type: "GET",
    url: "test.html #section_first",

    /* VERY IMPORTANT */
    contentType: "application/x-www-form-urlencoded; charset=utf-8",// or ISO-8859-1

    success: function(data){
           content.html(data);        
           hideLoading();           
    }
});

Upvotes: 1

Related Questions