javascript - html页面能否用js直接调用接口
巴扎黑
巴扎黑 2017-05-16 13:10:19
0
6
342

公司做一个商城网站,java的接口,而我朋友只会html,不会后端语言。
就可行性来讲,商城的所有页面全部用js跨域去掉用接口,中间都不经过任何后台语言,这样子一个项目做的成吗?

巴扎黑
巴扎黑

reply all(6)
给我你的怀抱

The oldest front-end and back-end separation is like this. HTML files are placed on the static server. The browser accesses the static server to get the HTML and other resource files. After parsing, it sends an ajax request to the backend interface. The backend returns the data in Fill in the browser.

The static server serves as the entrance, provides static file services, and forwards interface requests, so there is no need to cross domains.

The disadvantage of this solution is the SEO problem. If SEO is not considered, this architecture is feasible.

小葫芦

Yes, it will be no problem if the backend interface allows cross-domain access

Nowadays, many people use this method to separate the front and back ends. The front end only needs to do routing and data binding

淡淡烟草味

Yes, use CORS cross-domain.

Peter_Zhu

Yes, no problem

给我你的怀抱

No problem, you can. Use http protocol

淡淡烟草味

Use JSONP

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!