Click here to Skip to main content
15,798,066 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Looking for a quick cut/paste answer only. The following code was given to me by various users in different forums. I want to echo what's in the php to a dynamic textfield on the canvas.

php example:
$ToName = "aaa";
$FromName = "bbb";
echo ($ToName);
echo ($FromName);

ajax on the canvas:
	this.frame_0 = function() {
    let params = new URLSearchParams(;
    let EcardText = params.get("EcardText");
    return $.ajax({
        url: '' + EcardText + '.php',
        type: 'GET',
  	success: function (result) {
        error: function () {
//when you call this function
    .then(res => {
        //do something with the result only here

and this line is supposed to direct the data from the php to the designated textfield with the same instance name:
exportRoot.ToName.text = //I want the echo of ToName from the php to go here

The ajax code may be incomplete, might need data field, data type.. not sure how to fill out those fields.

Only asking for a fix to the code to make it all work. Not interested in detours (others suggested JSON, I really have no idea what that is or how it works.) All I know is that I need this as it is (php) to simply just work. Thanks.

What I have tried:

Tried the following:
exportRoot.ToName.text = 'test';

exportRoot.ToName.text = (result);

test shows test, so there's no conflicts on the name of the textfield receiving text.
result shows JohnDoe and JaneDoe in the same textfield, not what I want, but shows that the data is up for grabs, I don't don't know how to do it the right way...

exportRoot.ToName.text = $('ToName');

but it shows [object object] in the textfield.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900