How to take javascript data to a model in codeigniter?

0

I'm making an application using codeigniter and I would like to know how I could take the information I retrieved from a select tag in a javascript file to take it to a variable in my model

    
asked by Kev 11tk11 SD 30.12.2017 в 18:34
source

1 answer

1

You need to make a request AJAX against a path set by you on the PHP CodeIgniter server sending you the data you need and receiving a response (usually in JSON format) of whether or not your request went to the server with the response data.

  

Here is an example of a simple AJAX request:

var request = new XMLHttpRequest();
request.open('GET', '/my/url', true);

request.onreadystatechange = function() {
  if (this.readyState === 4) {
    if (this.status >= 200 && this.status < 400) {
      // Success!
      var resp = this.responseText;
    } else {
      // Error :(
    }
  }
};

request.send();
request = null;

Source

    
answered by 30.12.2017 / 18:45
source