php - How to pass an array of string using ajax? -
i'm using ajax pass array of strings page.
this array on nomes.php
[ 'home','a empresa','funcionarios','quem somos?','historia','inicio',]   this code, alert doesn't work - can help?
$.ajax({  type: 'post',  url: 'nomes.php',  beforesend: function(x) {   if(x && x.overridemimetype) {    x.overridemimetype("application/j-son;charset=utf-8");   }  },  datatype: "json",  success: function(data){     v=data;     alert(v);  } });      
you need encode php-array json-array.
<?php     echo (json_encode($myphparray)); ?>      
Comments
Post a Comment