Software Archive
Read-only legacy content
17061 Discussions

load csv in select

Luca_P_
Beginner
236 Views

Hi,

I'm beginner in Intel XDK. I'm trying to write my first app, helping with examples and tutorials.

I would like to load a csv file into a select. In PHP I write so:

        $file=plugin_dir_url(__FILE__).'coefficienti.csv';
        $delimitatore=";";
        if (($fp = fopen($file,"r")) !== false){
            // for each row of file
            while (($data = fgetcsv($fp,1000,$delimitatore)) !== false) {
                //insert row into select
                $echo .= "<option value='".$data[1]."|".$data[0]."'>".$data[0]."</option>";
                }
            fclose($fp);
        }
        $opzioniEta=$echo;

Now, how can I convert this in Js, to add in app.js file?

I'm using Xdk 3900 on Windows 7.

Thanks

Luca

0 Kudos
1 Reply
PaulF_IntelCorp
Employee
236 Views

This forum is not about teaching how to write JavaScript and communicate with a server. For that you are better served by the many JavaScript enthusiast sites on the Internet. Especially HTML5rocks and W3CSchools and Stack Overflow.

The XDK creates a standard Cordova CLI app (aka PhoneGap), so solutions that work with Cordova also work with the XDK.

0 Kudos
Reply