Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
120
rated 0 times [  126] [ 6]  / answers: 1 / hits: 41959  / 11 Years ago, sun, october 20, 2013, 12:00:00

I'm trying to get data from data.php via jQuery ajax call.



My code looks like this:



var jsonData;

$.ajax({
url: 'data.php',
success: function(response) {
jsonData = response;
}
});


My data.php file is returning json formatted data but some text is in Unicode format.
I set charset on data.php and on my javascript file, but still cant access responced data objects.



Any ideas?


More From » jquery

 Answers
28

Try to put dataType: 'json' in you ajax call:



var jsonData;

$.ajax({
url: 'data.php',
dataType: 'json',
success: function(response) {
jsonData = response;
}
});

[#74862] Friday, October 18, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
madelyn

Total Points: 449
Total Questions: 100
Total Answers: 100

Location: Seychelles
Member since Fri, May 7, 2021
3 Years ago
madelyn questions
Wed, Jul 28, 21, 00:00, 3 Years ago
Wed, Jul 14, 21, 00:00, 3 Years ago
Sat, Nov 7, 20, 00:00, 4 Years ago
Thu, Sep 3, 20, 00:00, 4 Years ago
;