javascript - file does not load properly according to visitor location -
I just have to ask the small parties, can you take a look at this code and what's the problem because it only The ph.php file also is from User America, which assumes that us.php :
& lt; Script language = 'javascript' & gt; Hostile country = Goplugin countdown (); Switch (country) {case (country = "UK"):
1 Javascript - Reload the related file on related countries
This is actually a file that is inside index.php called offer.php which is dynamically Calling other files depends on which country the user is, for example if a union is from UK then offer- uk.php must load and replace the variable in index.php
2 ) PHP -
I have to load this page as normal URL url : www.mydomain.com/index.php?noclid=abc123
using the $ _ request
dynamically via the noclid
variable Need to pass or whatever works as www.mydomain.com/index.php?noclid=abc123
to make it Inside the index.php file, I $ _ GET ['clid'] = '[[clid]]';
, but it's a matter of fact that I Noclid = abc123
not clid = abc123
.
Many have said that, you have probably mixed how to get server and client side resources You need to understand that when you submit a request for that resource, all the code for the code php
will be compiled and validated in the compiled code is.
Once the page is rendered in your browser, the Javascript comes into action if you still have included
specific php
If you want the files, you have to make appropriate requests on the server.
So in your case when you are bringing the country code in Javascript, you want to request another php script (let's call it at foo.php
Code> Post or get
request. You can then add appropriate files to different countries in the same switch
statement only switch will be in the
statement foo.php
. Then foo.php
can look something like this:
Lt ;? php $ count Ry = $ _POST ['country']; // Assume that you are requesting a post and passing the 'countrymen' switch ($ country) {case "UK": included ("../ .. Case "US": included ("../../us.php"); breakage; case "pH": included ("../../ph.php") ; Break; default: // If you want to handle this matter ..}? & Gt;
The AJAX request may just be:
Var country = geoplugin_countryCode (); ... $ .ajax ({type: "post", url: "foo.php", data: {countryid: country}}) .Done (function (msg) {// Ajax Request complete}};
If you are not clear on posting or receiving requests and passing data with it, then I recommend that you read some documents. Anyway, this is one of the many ways that you can get around your problem. Hope you got it started in the right direction.
Comments
Post a Comment