This time I will bring you a detailed explanation of the steps for using elexpressions in js. What are theprecautionsfor using el expressions in js. Here are practical cases. Let’s take a look. take a look.
Scenario:
After the page jumps, use spring mvc to pass a jsonobjectto the front-end page. After getting it in js, do the processing.
Returned json object:
{"nodes":[{"contactmobile":"15922208502","orderno":"XNH31918062989476864"},{"id":"12198","group":"11","content":"把考虑考虑","modelname":"Company"}],"links":[{"target":"12198","id":"15016","relationType":"公司","source":"12194"}]}
var graph; var flag = "${empty jsonData}"; if(flag!="true"){ graph = eval('(' + '${jsonData}' + ')'); };
There is a note here:
When using el expressions in js, be sure to use quotation marks. If the returned json contains double quotes, then use single quotes to surround the el expression, otherwise, use double quotes. In addition, pay attention to the writing method of using evalfunctionto convert the json string into an object.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website! Recommended reading:How the front-end transmits Json data to the backend
How to convert the html fields in the data into HTML tags
Use jQuery to preview locally when uploading images
The above is the detailed content of Detailed explanation of the steps for using el expression in js. For more information, please follow other related articles on the PHP Chinese website!