Saving Form Data to Plugin Record via Javascript I am new to Craft plugin development, so I apologize ahead of time for my lack of understanding. 

I'm working on a plugin that allows the user to "upload" Excel/csv files via the control panel that then get sent to an API via Javascript. I then want to save the returned data to my plugin's record. 

At the moment, I have a JSON object with all the necessary data and a record set up as such:
    

class GeocodeFile_LocationsRecord extends BaseRecord
{
    public function getTableName()
    {
        return 'geocodefile_locations';
    }

    protected function defineAttributes()
    {
        return array(
            'id'       =&gt; array(AttributeType::Number, 'required' =&gt; true),
            'type'    =&gt; array(AttributeType::Bool, 'default' =&gt; false),
            'name'       =&gt; array(AttributeType::Name, 'default' =&gt; null),
            'address'        =&gt; array(AttributeType::Name, 'default' =&gt; null),
            'city'         =&gt; array(AttributeType::Name, 'default' =&gt; null),
            'state'   =&gt; array(AttributeType::String, 'default' =&gt; null),
            'zip'       =&gt; array(AttributeType::Number, 'default' =&gt; false),
            'url'     =&gt; array(AttributeType::Name, 'default' =&gt; true),
            'lat'   =&gt; array(AttributeType::String, 'default' =&gt; null),
            'lng' =&gt; array(AttributeType::String, 'default' =&gt; null)
        );
    }
}


Is it possible to save this JSON data to the record directly, or is there a way to create a model in Javascript that could then be saved to the table? Perhaps I can send the data to a service that would handle it instead?

Clearly, I don't know how this is supposed to be handled. Any help with the matter would be greatly appreciated.

Sorry again for my naiveté on this subject!
Assuming you've got a controller endpoint in your plugin that has an action, the pseudocode for a simple solution could be something like:


Grab the JSON data from post.
json_decode it.
Loop through the JSON data.
Instantiate a new record and assign the properties to it inside the loop.  


i.e.

$record = new GeocodeFile_LocationsRecord();
$record-&gt;id = $jsonData['id];
$record-&gt;type = $jsonData['type'];
...
$record-&gt;save();