stamatis's avatar

Products edit page with pagination for image select from Model Image

Greetings to all, I am really confused beacause after a lot of hours reading,searching, practising ("new to Laravel and not only"), I cannot find a way to (luck of knowledge) do the following: When i edit a product (url.1 products/1/edit) i included a blade view that shows all images from the model images with paginator and it works. But when i click on the paginator link (exp. page2) the page refreshes and the url goes to products/2/edit?page=2 and the results are correct. I want to do that, without refeshing the page and without change the url. Ok..yes you can do this.. With Ajax... Actually that's the reason i need help from anyone can share a helpfull tip. I watched again an again a similar video on youtube but it gave me the half solution.. Please...anyone...how can i get all images with paginator in the product edit view in order to select an attach images to the product but without refreshing the page/change the url?? Thank you all in advance. Stamatis

0 likes
5 replies
stamatis's avatar

Thank U Mariam..really!! but this is not the solution i am looking for..Sorry!! :( The example was for paginating posts with ajax.. On my route : /products/id/edit -> i included images.blade.php with the content: pictures=Images::paginate(10) // paginate all image from images model foreach pictures as picture img src="picture->path" alt="picture->caption"> endforeach pictures->lists() // get the pagination page links

I want to find a way, when pressing the page link (page number) of paginator to make an ajax call and get the next 10 results/sets of images without refreshing the page or changing the url /products/id/edit.

Mariam's avatar

Stamatis, I have done the same but with angular, not sure it can help.

stamatis's avatar

Mariam..I owe you Coffee.. The example works.. if you add to the ajax the field -> data: {page : page} $.ajax({ url: '/products/img/page?'+page, dataType: 'json', data: {page : page}, // the missing data...!!! }).done(function(data){ $('.images').html(data); }); } and it works...!!!

See you on the next issue..!!

Please or to participate in this conversation.