Skip to main content

Posts

Vue js: fetching Data from API

in my code below i'm showing data from API for all flats in one page, but i couldn't figure out how to show the floor_number in each flat, below is my JSON body : { "response": [ { "floors": [ { "flats": [ { "status": "", "price": "80000", "currency": "USD", "end_date": "Not Set", "buyer": " ", "buyer_phone_number": "07701879915", "receipt_number_field": "058329", "size_unit": "M", "_id": "61e6bccba5da17be7a90fe2e",

jQuery input picker plugin filter results is not getting to normal after deleting a value from input

I have this php code in items_select.php file <?php require_once '../init.php'; $data = []; $q = ((isset($_GET['q']) && $_GET['q'] != '')?sanitize($_GET['q']):''); $item_select = $db->query("SELECT * FROM products WHERE itemNo LIKE '$q%' OR title LIKE '$q%'"); while($item = mysqli_fetch_assoc($item_select)){ $data[] = $item; } echo json_encode($data); ?> and in invoice.php I have the jQuery/javascript code <script> $(document).ready(function () { $('input#items').inputpicker({ url: 'parsers/items_select.php', fields:['itemNo','title'], fieldText:'title', fieldValue:'id', headShow: true, filterOpen: true, autoOpen: true }); }); </script> Now everything is working fine except, when I type/search/filter in the input a text or a value that is available in the options and I didn't

Using Place Autocomplete API to get Address Components

I am trying to to have a form that uses the Google Autocomplete API to populate a bunch of text fields after they click the name of the establishment. I am not super familiar with Javascript, so this one is somewhat of a struggle for me. As is, I am currently getting it to populate the Name into the input box and the latitude and longitude. But everything else (address, address2, city, state) gets populated with "undefined". Any ideas on how to get those values to populate into those input fields. <html> <head> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=API&libraries=places"></script> <script> function initialize() { var input = document.getElementById('searchTextField'); const options = { componentRestrictions: { country: "us" }, fields: ["address_components", "geometry", "icon", &

end to end example of training (regression) model using SageMaker Python SDK from visual studio code

I am aware of SageMaker Python SDK but I am still struggling to find a simple end to end example of training and deploying a model from Visual Studio code using the SDK. Can anyone please provide some pointers? Thanks! source https://stackoverflow.com/questions/71104457/end-to-end-example-of-training-regression-model-using-sagemaker-python-sdk-fro

Use innerHTML instead of document.write how to replace [closed]

Please i need to use innerHTML instead of document.write i try to do it but i fail <b:includable id='latestPosts'> <div id='latestPosts'> <div class='box-title-related'><h4 class='title'><svg aria-hidden='true' height='1em' preserveAspectRatio='xMidYMid meet' role='img' style='vertical-align: -0.125em;' viewBox='0 0 128 128' width='1em' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><radialGradient cx='68.884' cy='124.296' gradientTransform='matrix(-1 -.00434 -.00713 1.6408 131.986 -79.345)' gradientUnits='userSpaceOnUse' id='ssvg-id-firea' r='70.587'><stop offset='.314' stop-color='#ff9800'/><stop offset='.662' stop-color='#ff6d00'/><stop offset='.972' stop-color='#f44336'/></radialGradient><pat

object data editting form

I'm making django app which allow me to study. It has multiple tests with multiple question each. Every question has one correct answer. I'm trying to make form which allow me to edit answer If I made mistake in passing correct answer during making question. That's what I have already made: models.py class Question(models.Model): text = models.CharField(max_length=200, null=True) test = models.ForeignKey(Test, on_delete=models.CASCADE) created = models.DateTimeField(auto_now_add = True) def get_answer(self): return self.answer_set.all() def __str__(self): return self.text class Answer(models.Model): text = models.CharField(max_length=200) question = models.ForeignKey(Question, on_delete=models.CASCADE, related_name='parent') def __str__(self): return self.text forms.py class AnswerEditForm(ModelForm): class Meta: model = Answer exclude = ('question',) views.py def Update

I am trying to create 4 buttons in HTML that calls the following functions such as Adding, Subtracting, Multiplying, dividing

I am new to JavaScript and I'm a bit confused about what I'm doing wrong. For this Assignment I need to create 4 buttons in HTML that calls the following functions such as adding, subtracting, multiplying and dividing. I am suppose to prompt the user to enter two numbers and then it will calculate it. I figured out how to make one adding button but for some reason I am having trouble creating the other buttons for - * /. I am also not sure why it doesn't keep track of the calculations for the subtraction buttons and etc. I am kind of confused how to create multiple functions and buttons all in one program. function add() { var num1, num2, num3; numAdd1 = parseInt(prompt("Enter First Number:")); numAdd2 = parseInt(prompt("Enter Second Number:")); numAdd3 = numAdd1 + numAdd2 resultAdd = "Result is " + String(numAdd3) //document.write(numAdd3 + "<br>") document.getElementById("result").innerHTML =