Jump to content

Passing array result from php to jquery after ajax.post


Digger
Go to solution Solved by Digger,

Recommended Posts

0

I am trying to pass array results from a php submission form back to jquery i can trigger a success or fail message using toast.

i am using

$ret["icon"] = "success";

$ret["title"] = "Request Deleted Successfully";

echo json_encode($ret);

this is the result

{"icon":"success","title":"Request Deleted Successfully"}

but to trigget the toast object i need

Toast.fire({icon: 'success',title: 'Request Deleted Successfully.'})

Looking at the different i only need to remove the commas from the array key but i dont know how to do this in jquery or javascript

Can anyone please help

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.