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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -