Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9308171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:33:56+00:00 2026-06-19T00:33:56+00:00

I am doing an AJAX call and in the AJAX handler code (PHP side)

  • 0

I am doing an AJAX call and in the AJAX handler code (PHP side) I have to return a string containing the currency symbol. I have € to begin with in the PHP side, which I try to encode using html_entity_decode() but I am getting € when I alert the response in the javascript part.

I did html_entity_decode() of the value before returning the AJAX response in PHP –

$currency = "€"; //I am getting this from somewhere so I cannot change it. 
echo json_encode(array("message" => htmlentity_decode($currency)));

But still it shows € when I alert using javascript.

Even when I look at the firebug console, it shows €.

I also checked that in non-AJAX case, for a normal PHP page, if I echo the following, I get € as expected –

$currency = "€";
htmlentity_decode($currency);

So, What am I missing here. Do I need to set some character related stuff using header()? I tried this –

header("Content-Type: charset=UTF-8;");

I also checked Html entities like € is not converted to its symbol in CSV conversion

Update

Note: I tried setting $currency = “€” but that sets the “message” attribute of the response null. The response in the firebug console output shows this –

{"message":null}

Update 2

I use jQuery.

What I do with the response?

I just display the response in a confirmation message like this –

if(confirm(res.message)){alert("confirmed")}. //this renders html entities (€), I want this to render €

I checked that if I append the response to something in the UI, the Euro symbol € appears – $('.jqModal').append(res.message);

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T00:33:58+00:00Added an answer on June 19, 2026 at 12:33 am

    I checked that by not making any changes in PHP side and explicitly decoding the HTML entities in the javascript side, after receiving response, the problem gets fixed. I added this javascript function html_entity_decode() (phpjs.org/functions/html_entity_decode) and called it before alerting the response, but that too did not work (then I added support for Euro in that function) and now it works..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have many places in my code doing $.ajax call can I define one
i have an ajax call i am doing and its working just fine. thing
I am doing an Ajax call which pulls some HTML in to a Div.
I am doing an AJAX call that returns some HTML and jQuery: <div id='selected'>Here
I am doing an Ajax call and on response I would like to hide
i am doing an ajax call and i refresh a partial view. Inside the
On the client, I am doing a standard ajax call to an MVC action.
Not sure what I'm doing wrong but I can't get my JQuery AJAX call
Possible Duplicate: jQuery global variable problem I'm doing a jQuery AJAX call and I
I'm doing one app which requires AJAX call on almost every user interaction possible,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.