Get up to 80 % extra points for free! More info:

Discussion: javascript and jquery

Activities
Avatar
lawrence njoroge:5/15/2017 15:21

anyone to assit me in some javascript please?

<!--main page content-->
<div class="col-md-8"> <!--loads the content dynamically from the database-->
<div class="row">
<h2 class="text-center">Featured Products</h2>
<?php while ($product = mysqli_fetch_as­soc($r)):?>
<div class="col-md-3">
<h4><?php echo $product['title'];?></h4>
<img src="<?php echo $product['ima­ge'];?>" alt="<?php echo $product['title'];?>" class="img-thumb"/>
<p class="list-price text-danger">list price: <s> Ksh<?php echo $product['lis­t_price'];?></s><­/p>
<p class="price">Our price:Ksh<?php echo $product['pri­ce'];?></p>
<button type="button" class="btn btn-success" onclick="deta­ilsmodal(<? $product['id']?>)"> Details</button>
</div>
<?php endwhile;?>
</div>

</div>

jquery

<script>

function detailsmodal(id){
var data = {id;
jQuery.ajax({

url: <?=BASEURL;?>+ 'includes/deta­ilsmodal.php',
method: "post",
data: data,
success: function(){
jQuery('body')­.append(data);
jQuery('#details-modal').modal('tog­gle');
},
error: function(){
alert("something went wrong");
}
});
}

</script>

Reply
5/15/2017 15:21
where there is will there is a way
Avatar
IT Man
Member
Avatar
Replies to lawrence njoroge
IT Man:5/15/2017 16:00

Please, use the button between a smiley and B - it's for a code. Paste your code again between the code tags, because now it's very unreadable. :)

 
Up Reply
5/15/2017 16:00
Avatar
Replies to IT Man
lawrence njoroge:5/15/2017 16:07
<!--main page content-->
<div class="col-md-8"> <!--loads the content dynamically from the database-->
<div class="row">
<h2 class="text-center">Featured Products</h2>
<?php while ($product = mysqli_fetch_assoc($r)):?>
<div class="col-md-3">
<h4><?php echo $product['title'];?></h4>
<img src="<?php echo $product['image'];?>" alt="<?php echo $product['title'];?>" class="img-thumb"/>
<p class="list-price text-danger">list price: <s> Ksh<?php echo $product['list_price'];?></s></p>
<p class="price">Our price:Ksh<?php echo $product['price'];?></p>
<button type="button" class="btn btn-success" onclick="detailsmodal(<? $product['id']?>)"> Details</button>
</div>
<?php endwhile;?>
</div>

</div>

Javascript

<script>

function detailsmodal(id){
var data = {id;
jQuery.ajax({

url: <?=BASEURL;?>+ 'includes/detailsmodal.php',
method: "post",
data: data,
success: function(){
jQuery('body').append(data);
jQuery('#details-modal').modal('toggle');
},
error: function(){
alert("something went wrong");
}
});
}

</script>
Up Reply
5/15/2017 16:07
where there is will there is a way
Avatar
chris david
Member
Avatar
chris david:7/14/2023 9:22

If you need any help feel free to contact us.This is Chris professor at Assignment Planet, working for 5years. My company provide several services related to study for students.The assignment planet is a top-notch company that offers the java assignment help to its clients.

 
Up Reply
7/14/2023 9:22
To maintain the quality of discussion, we only allow registered members to comment. Sign in. If you're new, Sign up, it's free.

4 messages from 4 displayed.