Posts

Showing posts with the label post

search for custom post on AJAX response in WORDPRESS

search for custom post on AJAX response in WORDPRESS I search for a post with certain $value in posts of custom post type with custom field in AJAX response. Custom field is provided by ACF plugin. When button is clicked then AJAX request is send and posts are searched through. If custom_field of a post equals $value then I get id of that post if $value doesn't exist in any of custom posts then post is created and I get id of newly created post. Every post of custom_post contains custom_field . When I refresh page it works and post is not created for second time after second click. Otherwise the another click doesn't find a post so it is created again. I don't know why refresh helps. $value custom_field $value id $value id custom_post custom_field In content-page.php I call a function from my functions.php that generates links with: content-page.php functions.php jQuery(document).ready(function($) { jQuery( "body" ).click(function( event ) { v...

laravel redirect back to post route, i get MethodNotAllowedHttpException

laravel redirect back to post route, i get MethodNotAllowedHttpException At first on a get request i show a form, on submitting it, it goes to a post url does some working in the controller and then returns another view which has a form. after submitting this form i validate some things and if the validation fails i want to redirect back with some errors but unfortunately laravel isn't allowing me to redirect back to a post method. Is there any way i can accomplish this? i have seen this answer on laracast https://laracasts.com/discuss/channels/laravel/redirect-back-to-post-route-i-get-methodnotallowed-exception but i couldn't grasp the recommendation these are my routes in the order described above. Route::get('/purchasePacks', 'masterDealerController@purchasePacks')->name('purchasePacks'); Route::post('/confirmPuchasedPacks','masterDealerController@confirmPuchasedPacks'); Route::post('/storeOrder','masterDealerCont...