Creating dynamic bootstrap modals with php mysql and ajax [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
so I am working on a small ecommerce site and I've been stuck on this section of my site for quite a while now and can't really wrap my head around it.
I have divided the site into 3 columns with bootstrap's grid system, in the main section I have my featured products, however, I'd like everything to be dynamic, when I click on a modal with "View details" for the product the only code that works is the dynamic one, I'd like to know how to make it so that it pulls the data directly from my database, unfortunately out of frustration I deleted the little work I had done on it and can't show stick it on here so that anyone can correct it for me.
Could anyone please help me out?
Thanks!

There are many ways you could go about doing this. Here is an approach you could use:
Get the id from data attribute of your product (make sure you load it into the html).
Send a $.get request with jquery for this id to the server.
Get the data needed from the db using this id.
Render the data server side
Return html
In the callback function of your get request put the HTML into your bootstrap modal body.
Show the modal to the user.

Related

Scraping data which loaded after scrolling to bottom [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm working with PHP and I want to scrape some data from any website. But I have a problem. I scrape data but these items number are 48. But I know that page has 11K items. Rest of datas extend when you scroll and you get new bunch of datas (48 items).
I'm scraping with simple_html_dom. How can I manipulate scroll and get data ?
Thanks! :)
Sounds like the missing data is loaded via ajax.
Check the Network tab in the Developer Console (by pressing F12). Take a look at the URL which is being called (and the response), and edit it to your needs. Then call this URL instead of the one you are taking now.
It is impossible by this way.
But if you need to scrap this data you can send requests to endpoints which return lazily loaded data. You must research js code of target site.
p.s.
If you want to use really hard approach, you can research browser emulating.

Multiple HTML pages & Pagination [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Okay, so currently I'm creating a website from scratch for my small online shop and am stuck on where to even begin when it comes to my Products page. Currently, I have 1 page that displays all 50 of my products. I plan on expanding my products and do not want someone to be scrolling down the whole page. I would like to add multiple pages that you can click through and I believe I can accomplish this through Pagination. Now, this is the part where I get confused : say I only want 25 products to be displayed per page and I add a new item to the first page - how do items get 'bumped' to the page 2, 3 etc.? I would imagine there is some function to accomplish this, but the only way I can think of is doing this the brute force way of manually moving a product out of one page and onto another. Any suggestions??
Currently, my website is coded in all HTML / CSS and I currently just learned how to use PHP to mass edit certain areas of the website -- I am in the learning stages! Any suggestions would help. Thanks!
You need the help of a database to paginate your products in sets.
Basically, the database will have a "Products" table, each row in the table will represent a single product. You will use PHP to ask the database to retrieve the first/next N rows and then write out the appropriate HTML around each returned row to create a list of products.
There are lots of tutorials on the web to help you learn while you practice. Good luck!
There is no way to do that on static HTML web-site.
You need server-side script (e.g. PHP script) for splitting your product list by pages. By the way, you should store your data in DB and it should be done on the DB-side to not overhead your PHP side.

Populating a part of the site with dynamic content [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am a newbie and have been programming this site for a school. And I have been stuck in a part where I have to show the logged in users the subjects he/she is currently enrolled in. I am thinking of making it appear using Ajax with a click of a menu button on the left side. So how do I populate this with a card for each subject he/she is taking? The subjects is stored in a MYSQL database. I am currently using Codeigniter Framework. Would you suggest using scripts like Angularjs? I am very new to this. Here is the sample site:
If you are very new to this, I suggest you first use regular GET/POST based interactions with the site so that clicking on a button will reload this page, or a new one with the relevant information.
Once you have moved from total newbie to a novice/rookie, you can start converting some of those areas to Ajax.
Once you become fully comfortable with that, only then should you think using JavaScript frameworks like angularjs or backbonejs.
Its an incremental skillset acquisition, and is always best done like that.
All the best!

Pulling info from an external page [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Okay, bear with me. Part of my job is filling out online forms for customers who call in. In these forms there are all kinds of useful information that is hidden in input tags. I would like to make my own page that would extract and display all this useful information. I would also use this page to count the number of times I submit the form throughout the day.
The way I currently have it set up it is in a frameset. The left frame has links to the different forms we fill out, and when I click on one the external form is populated in the right frame. Javascript would be perfect for the job except that my frame is not located on the same server as the forms.
I stink at PHP. Not gonna lie. So i'm not looking for any hand-outs but any pointers would be great.
For example you may check out the forms on http://www.youcangetacar.com and you may use the pin code "A101" or you can check out what I have so far at http://customertrack.host-ed.me/
Make a page that cURL’s the page that is passed to it via url(curl.php?url=http://www.google.com) and then you dont have trouble with same domain policy.
Don’t forget to string replace relative urls with absolute urls.
eg, action="/submit/form.php" must become action="http://www.domain.com/submit/form.php"

How can users post after posts of others? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to display an add comment button(like in here or FaceBook) for all of the users' posts.
As you can see in here, if you click "add comment" button, small input box opens and your comment appears right below where you add it with smaller size than normal posts.
I am confused about which language would be the best for this. I know a little about JavaScript and jquery but i think doing it with php is not possible. An idea or example to do that would be greatly helpful.
JavaScript shows the form field, than makes an Ajax call to the server when the person clicks the add content button.
The server saves the content to the database, and returns a success message.
If successful, the JavaScript shows the comment and hides the form fields.
JavaScript and jquery its a client side technologies. Php is a server side. You need a proper database design and can choose any sever technology you like.

Categories