Home Ask Login Register

Developers Planet

Your answer is one click away!

Pankaj Jha February 2016

How to fetch value of key in array if key is of different content type

I am developing a plugin for wordpress which import products for woocommerce from a spreadsheet using ajax.

my spreadsheet have values of UTF-8 content type like Lyftrörelse | Egenhöjd | Plattformslängd

so when i upload my file using ajax and send it to my PHP file

DATA is being Sent Correctly. but when i am fetching values from that array in my Php file like

$valuefirst=$productarray["Lyftrörelse"];

var_dump($valuefirst);

is returning null,
but if i change my value of spreadsheet to ["Lyftrorelse"]

now when i print it like this

$valuefirst=$productarray["Lyftrorelse"];

var_dump($valuefirst);

It is printing my value, Earlier when i was doing this without Ajax there was no such Problem, My content was being read properly Any Suggestions ?

Answers


PHPExpert February 2016

Try with setting content-Type in your Ajax request,

contentType: "charset=utf-8",

Post Status

Asked in February 2016
Viewed 2,654 times
Voted 7
Answered 1 times

Search




Leave an answer


Quote of the day: live life