Move this topic
what to do if data-attribute is not working ?
in Using jQuery
•
7 years ago
Hi,
it looks like our Apache server is not configured to work with
html5, I talk to people in charge of the configuration but did not get
any help, maybe they don't know how to do that setup.
My question here is :
when my html page load, couple data attributes got populated from
the server side, but let say we have a static html code that has :
-
<tr id="24" data-one="[string1,string2,..stringn]" data-two="[otherstring1,otherstring7,...,otherstringm]" ></tr>
what can you advise me to use instead of data-attributes ?
thanks lot.
1
Replies(8)
A server does not need to be configured for HTML5.
Take a look at http://jsfiddle.net/jakecigar/toLn0gg8/ . Your
example is a string, but mine is an array.
JΛ̊KE
Leave a comment on jakecigar's reply
You didn't ask a question. Did you mean to?
You showed us one line of HTML with some data- attributes.
What is it that you think doesn't work?
Strings in JSON need to be contained in double-quotes. So, you
either need to use single-quotes to hold the JSON string itself, or
else you need to "escape" the quotes. The easy way is to use
single-quotes on the outside.
This would be valid:
<tr
id='24' data-one='["string1","string2","stringn"]'
data-two='["otherstring1","otherstring7","otherstringm"]' >
HTML5
has nothing to do with the server. Just like Honey Badger, server
don't care!
BTW,
I like to always use
single-quotes in HTML wherever I
can, just because it makes the code easier to read. It is less messy.
But for JSON encoding, you may
ONLY use double-quotes to contain strings. It works out nicely,
then, if you use single-quotes to hold the JSON-encoded string.
Leave a comment on watusiware's reply
JAKE, I learned all of these from you, you answered of lot of my
question on how to do things in jquery, the example I posted above
(<tr ..> ...,/tr>) I just typed it to show you that Apache
server swollow or stripe data attributes, maybe if you read this post
you will understand my problem, this post is similar to my situation :
thanks
Leave a comment on Majid Lotfi's reply
You need to teach mod_proxy to behave.
ProxyHTMLDocType Directive
The
default is changed to omitting any FPI, on the grounds that no FPI
is better than a bogus one. If your backend generates decent HTML or
XHTML, set it accordingly.
I consider mod_proxy dangerous if not configured properly.
With your configuration of mod_proxy, you can’t use data-
attributes or any user defined attributes. Your hands are tied, and
I have no advice other than fixing your ProxyHTMLDocType settings.
JΛ̊KE
Leave a comment on jakecigar's reply
In your link the OP mentioned
mod_proxy_html
- Apache HTTP Server Version 2.4 says to use
Thanks
for the feedback! That ended up having no effect for me,
but it did give me new research ideas, leading me to
this link,
which indicated that SetOutputFilter has been superseded
by ProxyHTMLEnable in mod-proxy 3.1 and on. When I set
ProxyHTMLEnable Off, the removal of unknown HTML tags
stopped. As long as I am using relative URLs only my
problem is solved. – Mike
C
Feb
3 ’14 at 14:26
|
ProxyHTMLEnable Off |
JΛ̊KE
Leave a comment on jakecigar's reply
I am sorry, I am going to stop it here, I know this forum is for strict
jquery questions.
I told them to set ProxyHTMLEnable Off
but the person in charge of Apache told me :
Thank you JAKE and watusiware.Hi ,
From the Apache HTTP Server Documentation:
The Apache HTTP Server mod_proxy_html provides an output filter to rewrite HTML links in a proxy situation, to ensure that links work for users outside the proxy. It serves the same purpose as Apache's ProxyPassReverse directive does for HTTP headers, and is an essential component of a reverse proxy .
ProxyHTMLEnable Directive A simple switch to enable or disable the proxy_html filte
Rewriting the HTML links in a proxy situation is essential, if ProxyHTMLEnable is turned off, the backend applications will not work either.
Whatever the problem is, turning off ProxyHTMLEnable is not the solution.
Leave a comment on Majid Lotfi's reply
Rewriting the HTML links in a proxy situation is essential
It seems it's making gratuitous changes to HTML that has
nothing to do with links.
Shouldn't it need only to re-write hrefs and other types of
URL references?
Egads, what happens if you code links into Javascript?
They are destroyed/corrupted/mangled. Majid’s net people are foolish.
JΛ̊KE
Leave a comment on watusiware's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic
Reply to Majid Lotfi's question