Timeline for Why Wordpress AJAX returns undefined however it works fine when I add static url instead of dynamic function?
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 11, 2022 at 9:09 | comment | added | Tom J Nowell♦ | it's the same problem if you try and do it with plain JS by joining together HTML strings, build your DOM nodes and append them rather than passing it a big HTML string and it'll be much harder to hack you. The browser will do a tonne of security stuff for you, like checking the URL is a valid URL and formatting everything properly for free | |
Aug 10, 2022 at 15:18 | comment | added | Huzaifa Qayyum | This is new. I just started using jquery. Before I was relaying on plain js | |
Aug 10, 2022 at 15:15 | vote | accept | Huzaifa Qayyum | ||
Aug 7, 2022 at 18:53 | history | edited | Tom J Nowell♦ | CC BY-SA 4.0 |
added 2 characters in body
|
Aug 7, 2022 at 18:52 | comment | added | Tom J Nowell♦ |
you shouldn't build your HTML out of strings in javascript, it's insecure. jQuery already provides methods of doing it by building nodes. Don't do this: jQuery( '<a href="' + url '">test</a>') it's dangerous, you should do jQuery( 'a', { href: url, text: 'test' } ) instead it's safer and avoids a lot of exploits and attacks
|
|
Aug 7, 2022 at 18:50 | answer | added | Tom J Nowell♦ | timeline score: 2 | |
S Aug 7, 2022 at 18:24 | review | First questions | |||
Aug 8, 2022 at 3:02 | |||||
S Aug 7, 2022 at 18:24 | history | asked | Huzaifa Qayyum | CC BY-SA 4.0 |