Jump to content
php.lv forumi

Json Php Jquery - datu apmaiņa


Wuu

Recommended Posts

<?php 
$res = json_decode($_REQUEST['data'], true);

$send = array ('data'=>'i am php','say'=>$res);
echo json_encode($send);
?>

 

function send(data) {
$.getJSON('jCore.php', { data: "i am json" }, function(json){
    	alert('php say: ' + json.data + ' ' + json.say);
    });
}

 

Nespēju ar php nolasīti 'i am json' datus un nosūtīti tos atpakaļ, kur kodā kļūda? Visu laiku atbilde 'null'

Link to comment
Share on other sites

Šādi strādā!

	$send = array ('data'=>'i am php','say'=>$_REQUEST['data']);

 

Tad kāda velna pēc ir vajadzīgs $res = json_decode($_REQUEST['data'], true); ? Kurš neatgriež neko? Vai arī mans manuālis ir fake and gay?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...