Jump to content

Add HTML markups dynamically in a JSON file with PHP


Jules Vau
 Share

Recommended Posts


I would love to put HTML markups (created dynamically by ProcessWire) in a JSON file. Then I could reach it by an ajax call.

I know that I have to escape double quotes in the html string by adding "\" like below.

{
  	"title": "Title",
	"data": "<main id=\"container\"><div class=\"my-class\">My data created my ProcessWire templates</div></main>"
}

But I don't know how to do it dynamically. There is a ProcessWire trick? or sould I write my own function?

 

 

Link to comment
Share on other sites

On 7/31/2021 at 10:16 PM, Jules Vau said:

I find a solution. I don't know how to remove the question.

We do not remove regular questions, also not when we have found a solution.
We do share the solutions with the community.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...