Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Getting utf-8 problems with .get in jquery code

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #27403
    fiunchinho
    Member

    Hello everyone. Im getting utf-8 problems.
    I have a blog with comments, and if someone writes a new comment while you are reading the comments, it shows a message "Click here to show new comments".

    Im using the next code to call a php page with some data, that returns some HTML with the new comments that I want to show. The problem is that it doesnt show áéó characters. I think it’s because it’s not utf-8, but the comments are perfectly coded in database (utf-8), and they are showed right if I refresh the page. The problem is just the AJAX response.

    Quote:
    $("#notifier").click(function() {
    var post = <?=$post_id?>;
    var last = <?=$currentTime?>;
    $.ajax({
    type: "GET",
    url: "check.php",
    data: ({last : last , post: post , get: 1}),
    dataType: "html",
    contentType: "application/text; charset=utf-8",
    success: function(msg) {
    // Replace the div’s content with the page method’s return.
    $("#newComments").css("display","block");
    $("#newComments").html(msg);
    }
    });
    });

    Any ideas ? What’s wrong? I also tried using the next code, but same behaviour

    Quote:
    $.get("check.php", { last: last , post: post , get: 1} , function(data){
    $("#newComments").css("display","block");
    $("#newComments").html(data);
    });

    Thank you for your help

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.