Welcome Guest, Not a member yet? Register   Sign In
Ajax concatenate query
#21

(07-13-2017, 11:36 AM)pippuccio76 Wrote:
(07-13-2017, 10:52 AM)Paradinight Wrote:
(07-13-2017, 10:44 AM)pippuccio76 Wrote:
(07-13-2017, 09:44 AM)pippuccio76 Wrote:
(07-13-2017, 09:13 AM)pippuccio76 Wrote: It's a free host this is the page :

link with ajax problem
I change the code of metdod with a value (costant) instead a $_POST value , the problem is the same , but if i visit the link :

link

the method work correctly

Problem partially solved :

if i set $config['csrf_protection'] = FALSE;


the ajax call work , but is it secure ?

How can i secure the script ?

you need to return a new token.

https://www.codeigniter.com/user_guide/l...rgery-csrf

return a json string with the html and the token

I use form_open() but i don't understand wath i have to do ....
This is my  new code :
Code:
$(document).ready(function() {
 $("#regione_id").change(function(){
   
   $("#comune_id").html('<option value="" selected="selected">-- seleziona --</option>');
   
   var regione_id = $("#regione_id").val();
   console.log(regione_id);
   $.ajax({
     type: "POST",
     url: "<?php echo site_url(); ?>/user/get_province",
     data: {

func: 'getNewLocations',
                               '<?php echo $this->security->get_csrf_token_name(); ?>' :
                               '<?php echo $this->security->get_csrf_hash(); ?>',
                               regione:regione_id},  
     dataType: "html",
     success: function(msg)
     {
       $("#province_id").html(msg);
     },
     error: function()
     {
       alert("Chiamata fallita, si prega di riprovare...");
     }
   });
 });
 


The first call it's ok , the second the same error
Reply


Messages In This Thread
Ajax concatenate query - by pippuccio76 - 07-10-2017, 01:50 PM
RE: Ajax concatenate query - by rtenny - 07-12-2017, 08:50 AM
RE: Ajax concatenate query - by pippuccio76 - 07-12-2017, 09:16 AM
RE: Ajax concatenate query - by rtenny - 07-12-2017, 08:55 AM
RE: Ajax concatenate query - by pippuccio76 - 07-12-2017, 09:22 AM
RE: Ajax concatenate query - by Paradinight - 07-12-2017, 09:43 AM
RE: Ajax concatenate query - by pippuccio76 - 07-12-2017, 10:58 AM
RE: Ajax concatenate query - by Paradinight - 07-12-2017, 11:08 AM
RE: Ajax concatenate query - by ivantcholakov - 07-12-2017, 11:12 AM
RE: Ajax concatenate query - by pippuccio76 - 07-12-2017, 12:08 PM
RE: Ajax concatenate query - by Wouter60 - 07-12-2017, 11:40 AM
RE: Ajax concatenate query - by ivantcholakov - 07-12-2017, 12:19 PM
RE: Ajax concatenate query - by pippuccio76 - 07-13-2017, 09:13 AM
RE: Ajax concatenate query - by pippuccio76 - 07-13-2017, 09:44 AM
RE: Ajax concatenate query - by pippuccio76 - 07-13-2017, 10:44 AM
RE: Ajax concatenate query - by Paradinight - 07-13-2017, 10:52 AM
RE: Ajax concatenate query - by pippuccio76 - 07-13-2017, 11:36 AM
RE: Ajax concatenate query - by pippuccio76 - 07-14-2017, 04:16 AM
RE: Ajax concatenate query - by Paradinight - 07-13-2017, 10:45 AM
RE: Ajax concatenate query - by skunkbad - 07-12-2017, 03:37 PM
RE: Ajax concatenate query - by pippuccio76 - 07-13-2017, 04:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB