Categories
Mastering Development

Can’t insert Data into Database using AJAX JQUERY CODEIGNITER

So i’m trying to post data to the server and insert it into my database but i’m having trouble to do so ! the form <form name=”cart” id=”myForm”> <div class=”row”> <div class=”col-lg-6 col-md-12 mt-25″> <h6 class=”invoice-to”>Bill To</h6> <fieldset class=”invoice-address form-group”> <input type=”text” name=”Fullname” class=”form-control” value=”Full Name”> </fieldset> <fieldset class=”invoice-address form-group”> <input type=”text” name=”Wilaya” class=”form-control” placeholder=”Wilaya”> […]

Categories
CMS Mastering Development Wordpress

Get get Current Page ID in functions php, meta query filter

How do I get the Current Page ID in functions php when creating an meta query filter? I’ve made many attempts but all return Null. The filter works as expected when I manually input a number, but I need it to automatically echo the current post ID. Any guidance is appreciated, thanks. $args = array( […]

Categories
Mastering Development

No ‘Access-Control-Allow-Origin’ cors – 403 – Google Cloud functions

I am trying to POST some data on the client-side to Google Cloud functions locally and I’ve tried on a staging environment: This is the error I’ve received: Access to XMLHttpRequest at ‘https://abc-mywebsite.cloudfunctions.net/functions-1’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. In my cloud function, […]

Categories
CMS Development Wordpress

Fragments to Update Cart Counter not working on homepage – Woocommerce

I’m creating a website where the users can add a product to cart (using ajax) from homepage. I’m using a JS function to do this, and it’s working. Also, I have a function that updates the custom cart counter from header. If i’m on Shop or Cart page, the woocommerce fragments works perfectly, updating my […]

Categories
CMS Development Wordpress

ajax contact form not submit message

I’m havingo some trouble with a contact form I’m working on. I’m using ajax to submit it and I’ve noticed that from localhost and from the production server, the test messages I’ve sent will not be delivered. I’m not sure if it’s a network delay or if this is caused because I’m using wordpress nonces. […]

Categories
Mastering Development

Concert R GET method into Python

I am new to Python; currently, I need to convert the below R code to Python, I know I need to use requests library; however, I don`t know how to convert the authenticate(cibc_username, cibc_password,”gssnegotiate”) into Python. So, could anyone help me to resolve it? The R code below: hr_page = GET(url, user_agent(“””Mozilla/5.0 (Windows NT 10.0; […]

Categories
Mastering Development

How to retrieve the instance of a chart that is not global

I am creating like 10 charts with chart.js like this: new Chart(document.getElementById(“chart01”), { type: ‘doughnut’, data: data, options: options }); new Chart(document.getElementById(“chart02”), { type: ‘doughnut’, data: data, options: options }); As you can see, I am not using a var chart01 = new Chart(… because I do not want have all these charts globally. However, […]

Categories
Development

How to change input submit from disabled to enabled when email is validated on the backend with PHP?

The Login button should only be enabled when the user enters a valid e-mail address into the Username field. Currently e-mail validation is handled through a PHP script. Any suggestions, alternatives or documentation to look into would be great. index.html <!DOCTYPE html> <html> <head> </head> <body> <div id=”login-input”> <form action=”login.php” method=”post” class=”ajax”> <p> <input id=”login-username” […]

Categories
Development

Sending an array of integer values via AJAX post to Flask view

Suppose you have an array in javascript – [1,2,3] and you want to send it via AJAX post to Flask. So that in JS: array = new Array() array.push(1); array.push(2); array.push(3); var data = JSON.stringify(array); $.ajax({ type: “POST”, url: “myurl”, data: data, dataType: ‘JSON’, success: alert(“messagesent!”) }) And in Flask view : @bp.route(‘myurl’,methods=[‘GET’, ‘POST’]) def […]

Categories
Development

How do I create an async CRUD function that create a user, generate a token and login the user in node.js and Postgres?

NOTE: I am using node.js, express.js, Postgres and pg-promise library. WHAT I WANT I want the createUser function to create a new user with a hashed password, generate a token and login the user. I want to be able to see the token generated in Postman so that I will know if the code is […]