You can take your prescription to another optician and buy glasses from another practice. You should get the written prescription, following the eye examination, from your optician. After that, you are free to take the prescription to any other practice.
The prescription must provide the basic results of the eye examination. But, the basic results might not be enough for getting proper eye glasses. Other measurements or results which are needed to dispense glasses, will need to be taken by the practice where you buy the glasses, especially measurements related to the position of the lenses within the frame, related to your eyes- you should be aware of this if you intend to buy glasses online.
You should also be aware that complaints about your eyewear or prescription could be more difficult to handle if more than one practice has been involved. Resolving your dissatisfaction will be more complex.
The best way to avoid complications is to buy the glasses from the same practice where you got your prescription. They will know about all the extra measurements (which is not mandatory in the basic prescription of your eyewear). Using the same practices gives both you and the fitting optician an advantage. It is also easier for you if something needs to be corrected with your new glasses. Purchasing on the internet might be a cheaper cost, but it may also bring a higher risk- it takes more effort to get a problem fixed.
In all, it is up to you. You can take your prescription anywhere. Is it price, convenience, product range, quality, trust, or something else?
You should decide what is most worthy for you.