How to write on csv in ajax php
-
Hello, I am trying to write on CSV file in PHP
I have an array of values that I’m looping through to write on a CSV file
when I write the code on a separate file and open the file in the browser then I can see my values in the CSV file but when I write the code in a function which is in functions.php file and I am calling the function in jquery ajax call.
but when I use this by ajax call it do not write on csv file
Why is this happening?
This is the code I’m using$csvfile = 'activity.csv'; $list = array ( "write, values,in, CSV,file" ); $file = fopen($csvfile,"w"); foreach ($list as $line) { fputcsv($file,explode(',',$line)); } fclose($file);
I am using the same code in a separate file and n function which I’m calling in ajax
but the code is working in a separate file and not working in ajax calls.
BTW I’m getting a response in ajax call like
‘Resource Id#1322’Can anyone help?
Thanks
- The topic ‘How to write on csv in ajax php’ is closed to new replies.