B4J Question [Server] Problem with ws.eval

dar2o3

Active Member
Licensed User
Longtime User
when ws.eval use to inject HTML code, I have a problem when I try the following

B4X:
ws.Eval("$('#expe').append("<span class=new badge>4</span>"), Array As Object() )

and I tried this but it does not work

B4X:
ws.Eval("$('#expe').append("<span class=new class=badge>4</span>"), Array As Object() )


when "class = one two three" has more than one property does not work properly.

any suggestions?
 
Last edited:

dar2o3

Active Member
Licensed User
Longtime User
thanks for answering


I use materializecss framework, this html code produces the following
B4X:
 <a href="#" class="collection-item">Unread<span class="new badge">4</span></a>
upload_2016-5-18_22-20-47.png


but this code in b4j produces the following

*1

B4X:
ws.Eval("$('#expe').append('<a href=# class=collection-item>Imbox<span class=new badge>12</span></a>')",Array As Object())

upload_2016-5-18_22-32-24.png


and this code gives this result

*2

B4X:
ws.Eval("$('#expe').append('<a href=# class=collection-item>Imbox<span class=new>12</span></a>')",Array As Object())

upload_2016-5-18_22-32-24.png


the difference in the two previous examples is in *1<span class=new badge> *2 <span class=new>





the same code does not work with single quotes.

B4X:
ws.Eval("$('#expe').append('<a href=# class='collection-item'>Inbox<span class='new badge'>4</span></a>')",Array As Object())



I understand it is a problem with the quotes, but not how to fix it.




I solved the problem by using.

B4X:
expe.SetHtml("<a href='#' class='collection-item'>Unread<span class='new badge'>4</span></a>")

but I continue to wonder how to do with ws.eval.
 
Last edited:
Upvote 0
Top