Home Backend Development PHP Tutorial 关于那些购物网站解决办法

关于那些购物网站解决办法

Jun 13, 2016 am 11:59 AM
ajax name nbsp price

关于那些购物网站
那些购物网站有那种选不同颜色不同size就价钱不同然后显示出来,
用了什么技术?
是ajax吗?
php新手
谢谢
------解决方案--------------------
有些是Ajax异步读取的。。
当点击不同的颜色和尺寸时进行Ajax交互读取新价格。

还有一种是页面加载完成后就载入了全部不同组合的价格。然后选择与页面相匹配的那种商品显示其价格。
当点击不同颜色和尺寸时,切换到你选择的那种商品的价格。

<br />{<br />"qikequanmai":{"name":"奇客花生香酥全麦饼 110克/盒  6盒组合","price":"¥99.00元"},<br />"qikecongxiang":{"name":"奇客葱香全麦饼 110克/盒   6盒组合","price":"¥99.00元"}<br />}<br />
Copy after login

------解决方案--------------------
楼上正解,看你的数据量,如果仅仅几种颜色+尺码同时用户可能来回点,用本地js搞定,不能用ajax占连接,像全国地区数据就ajax吧
------解决方案--------------------

引用:
Quote: 引用:

一般不会用ajax吧,还增加请求
直接用js就行了,php传个配置数组到js,点击图片的时候js修改下价格就行了...


其实我也想用js这样弄的.
但是我这个点击了不但要改价格还要改图片,规格,还有各种div里的内容.

想了想还是想用ajax直接刷新整个页面方便算了.
这样弄增加请求会不会弄到网站很慢?


ajax给服务器增加压力本来就不对了,
居然想刷新页面,压力不就更大。

虽然增加一点ajax请求可能看不出来(只要服务器够强就没事)
但做技术的凡事要尽量用最好的解决方案,要有精益求精的工匠精神,这是态度问题!
而且一般精益求精的时候对自己的技术是有帮助的,比如用js做刚好能练习下js。

但是要改很多div的话我觉得是设计问题。
就淘宝商品页面来说,一个商品一般就改个当前颜色的文字和商品图片就行了
介绍页面就不用改了,全部介绍一下。没有改个颜色还要改介绍文字的。
而更新个当前颜色、尺寸,图片,价格 最多5个地方会多吗?
封装个方法,然后把当前颜色大小传进去统一更新页面就行了
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Fujifilm X-M5 price expectations rise as leaked selfie display adds complexity to the formerly affordable camera line Fujifilm X-M5 price expectations rise as leaked selfie display adds complexity to the formerly affordable camera line Sep 07, 2024 am 09:34 AM

Fujifilm fans were recently very excited at the prospect of the X-T50, since it presented a relaunch of the budget-oriented Fujifilm X-T30 II that had become quite popular in the sub-$1,000 APS-C category. Unfortunately, as the Fujifilm X-T50's launc

How to solve the 403 error encountered by jQuery AJAX request How to solve the 403 error encountered by jQuery AJAX request Feb 20, 2024 am 10:07 AM

Title: Methods and code examples to resolve 403 errors in jQuery AJAX requests. The 403 error refers to a request that the server prohibits access to a resource. This error usually occurs because the request lacks permissions or is rejected by the server. When making jQueryAJAX requests, you sometimes encounter this situation. This article will introduce how to solve this problem and provide code examples. Solution: Check permissions: First ensure that the requested URL address is correct and verify that you have sufficient permissions to access the resource.

FiiO CP13 cassette player launches with transparent retro look FiiO CP13 cassette player launches with transparent retro look Jun 16, 2024 am 09:52 AM

TheFiiOCP13cassetteplayerwasannouncedinJanuary.Now,FiiOisexpandingitsportfoliowithtwonewmodels-onewitharedfrontandonewithatransparentfront.Thelatternotonlyperfectlymatchestheretrocharmoftheangulardesign,butalso

Klipsch unveils Flexus Core 300 flagship soundbar with 8K support, 12 speakers and room correction Klipsch unveils Flexus Core 300 flagship soundbar with 8K support, 12 speakers and room correction Sep 05, 2024 am 10:16 AM

The Klipsch Flexus Core 300 is the top model in the series and is positioned above the already available Flexus Core 200 in the company's soundbar line-up. According to Klipsch, this is the first soundbar in the world whose sound can be adapted to th

How to solve jQuery AJAX request 403 error How to solve jQuery AJAX request 403 error Feb 19, 2024 pm 05:55 PM

jQuery is a popular JavaScript library used to simplify client-side development. AJAX is a technology that sends asynchronous requests and interacts with the server without reloading the entire web page. However, when using jQuery to make AJAX requests, you sometimes encounter 403 errors. 403 errors are usually server-denied access errors, possibly due to security policy or permission issues. In this article, we will discuss how to resolve jQueryAJAX request encountering 403 error

PHP and Ajax: Building an autocomplete suggestion engine PHP and Ajax: Building an autocomplete suggestion engine Jun 02, 2024 pm 08:39 PM

Build an autocomplete suggestion engine using PHP and Ajax: Server-side script: handles Ajax requests and returns suggestions (autocomplete.php). Client script: Send Ajax request and display suggestions (autocomplete.js). Practical case: Include script in HTML page and specify search-input element identifier.

Light Phone 3 launches with 50% discount, monochrome OLED and minimalist design Light Phone 3 launches with 50% discount, monochrome OLED and minimalist design Jun 13, 2024 pm 10:18 PM

WhiletheLightPhone2from2018wasstillequippedwithaneconomicale-inkdisplay,theLightPhone3usesanOLEDdisplaythatcanonlydisplaygrayscale.Thereasonfortheswitchtothe3.92-inchOLEDpanelwithitsresolutionof1,240x1,080isth

How to solve the problem of jQuery AJAX error 403? How to solve the problem of jQuery AJAX error 403? Feb 23, 2024 pm 04:27 PM

How to solve the problem of jQueryAJAX error 403? When developing web applications, jQuery is often used to send asynchronous requests. However, sometimes you may encounter error code 403 when using jQueryAJAX, indicating that access is forbidden by the server. This is usually caused by server-side security settings, but there are ways to work around it. This article will introduce how to solve the problem of jQueryAJAX error 403 and provide specific code examples. 1. to make

See all articles