Categories
Mastering Development

Application with multiple onpost asp-page-handler buttons sometimes not working after one or two clicks?

In my asp.net core razor page application, I have a server-side datatable along with a few buttons that run different onpost methods using the "asp-page-handler" tag. My problem is that once I click one or two buttons, sometimes (not every time, but most of the time I’d say) it doesn’t allow me to click any […]

Categories
Mastering Development

Can’t generate an error response when user is not verifying recaptcha

everything is working perfectly but for some reason i can’t generate a error response when the user is not checking the ReCaptcha button. the form wont send until the user is checking that he is not a robot. I built a controller for the recaptcha that works perfectly fine and the error msg that it […]

Categories
Mastering Development

Datatable version 1.10.21 is stuck on ‘processing…’ in ASP.NET Core 3.1

I am using Datatable 1.10.21 in ASP.NET Core 3.1 and I am stuck on ‘processing…’. I am catching exceptions should they occur but so far I haven’t seen any exceptions. For reasons unknown to me, database records are not shown. Could you spare a moment and take a closer look at my code to determine […]

Categories
Mastering Development

Django forms: how to get product’s data from db with ajax

I have models (ShopStock and SaleItem), I have registered product and price in ShopStock model, in SaleItem model i also have product and price fields. What i want is when i select a product in (SaleItemForm) the price field to be filled with a price from Shopstock model. I have no idea how to do […]

Categories
Mastering Development

Call PHP page from JQUERY with JSON parameter

I’m trying to call a PHP page from JQUERY with JSON object as the parameter. AJAX call seems like able to reach the PHP page (returned SUCCESS) but it looks like failed in PHP as I’m not getting what I expected. I simplified my code to the following: JAVASCRIPT: var tocmbid = document.getElementById("inp_tocmbid").value; var tocmblchg […]

Categories
Mastering Development

JQuery chosen Dynamic ajax call option duplication issue, If use empty() element then lose default selected value

$(this.el).ready(function(){ setTimeout(function(){ var subItemsData = []; $(self.el).chosen({ width: ‘100%’, allow_single_deselect: true, no_results_text: "Oops, nothing found!", search_contains: false, max_selected_options: self.params.maxselected ? self.params.maxselected : 0 }).on(‘change’, function(evt, params) { var value = $(self.el).val(); self.set(value); console.log("value",value); }).on(‘chosen:showing_dropdown’, function(evt, params) { }) $(‘#patient_diagnosis_chosen ul li.search-field input’).autocomplete({ source: function( request, response ) { if(request.term.length >= self.params.minlength){ $.ajax({ url: baseURL+’api/service/v1/patient/patient-diagnosis’, dataType: […]

Categories
Mastering Development

How to pass Holiday Dates from controller in View in Laravel using JSON

I am using JQuery-UI datepicker in Laravel-5.8 Controller: public function findNationalHoliday(Request $request) { $nationalholidays = HrHolidayDate::select(‘holiday_date’)->where(‘company_id’, $userCompany)->whereYear(‘created_at’, ‘=’, date(‘Y’))->get(); return response()->json([ ‘nationalholidays’ => $nationalholidays, ]); } View <script type=”text/javascript”> $(document).ready(function() { $(document).on(‘change’, ‘#leave_type’, function() { var air_id = $(this).val(); var a = $(this).parent(); var op = “”; $.ajax({ type: ‘get’, url: ”, data: { ‘id’: […]

Categories
Mastering Development

How to solve CORS Origin issue when trying to get data of a json file from localhost

I was trying to get the data from a json file (which is on the remote server) from localhost and I am getting error ‘from origin ‘http://localhost:5000’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.‘ Below is the code […]

Categories
Mastering Development

Error in my CJ Affiliate API request code

I want to get products from CJ and give an error in my API request. This is the code url: "https://ads.api.cj.com/query", beforeSend: function(xhr) { xhr.setRequestHeader("Authorization", "Bearer <removed>"); }, type: ‘GET’, dataType: ‘json’, contentType: ‘application/json’, processData: false, data: JSON.stringify({ query: `{ products(companyId: "<removed>") { resultList { advertiserId, catalogId, id, title, description, price { amount, currency } […]

Categories
Mastering Development

Pass updated model to from view to controller using Ajax

I have the following simple class with student firstname and lastname properties. When the view for this model loads, I want to add additional columns to assign cost related information for each row, so that I added two fields in my DOT class i.e. StudentDoaminModel. The views loads ok, but the value for each of […]