FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » to fill a select with json javascript from arrays
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: to fill a select with json javascript from arrays [message #175079 is a reply to message #175072] Thu, 11 August 2011 00:12 Go to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Wed, 10 Aug 2011 14:13:10 +0200, nawfer wrote:

> in JSON/javascript ....

If you're trying to create a json string from PHP array data to send to a
javascript application:

http://uk2.php.net/manual/en/function.json-encode.php

If you're trying to create a PHP array or object from json data that has
been created by a javascript application:

http://uk2.php.net/manual/en/function.json-decode.php

if you're trying to create json data with javascript, or create a
javascript object from json data, try asking in a javascript newsgroup or
forum, not a php one.

If you're trying to send a string of json encoded data in response to a
client side ajax style request:

<?php
// process the request
// create the data string to send
echo $json_encoded_string;
?>

Note that generally you don't want to include any other output, and
specifically no html tags.

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: json_decode
Next Topic: Calling stored procedure on remote SQL Server machine with PDO
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 19:34:04 GMT 2024

Total time taken to generate the page: 0.04149 seconds