Skip to content
Advertisement

Properly use single and double quatation in PHP

I have my PHP code like below and its work fine

JavaScript

Now I am loading more data on press load more button via ajax

so I am trying like this

JavaScript

But now tr html code looks like this

JavaScript

so its not correct code for window location, its need like this

JavaScript

I am new in PHP and trying from half hour to make it working but not getting idea how I can do it, Let me know if anyone here can help me for do the same. Thanks!

Advertisement

Answer

You will need to escape some single quotes for the single quotes used in the javascript in the onclick attribute.

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement