0

I am working on a mobile app and I have a scenario where the user upon selecting an image (For example: the mode of payment- credit card will have an image, money will have an image) thorough on-click function the color of the image should change and the data should be retrieved from database.

I am able to fix the on-click color change option but unable to access data from database. Please help me with this.

This is the code below:

<div class="container">
<table style="width:60%;text-align:center; ">
<thead>
<tr>
<td colspan="4" style="border-right:1px solid;">Mode of transport:(click to     select)  
</td>
<td colspan="2" >Mode of payment:(click to select)
</td>
</tr>
<thead>
<tr>
<td><img id="p2" src="./images/car_blue 120.png"  style="width:60px;height:60px;" onclick="" />
</td>
<td>
<img id="p2" src="./images/Bus_blue 120.png" style="width:60px;height:60px; " onclick="" />
</td>
<td>
<img id="p2" src="./images/plane_blue 120.png"   style="width:60px;height:60px; " onclick="" />
</td>

<td>
<img id="p2" src="./images/cash_blue 120.png" style="width:60px;height:60px; padding:5px;" onclick="" />
</td>
<td>
<img id="p2" src="./images/credit_card_blue 120.png" style="width:60px;height:60px; padding:5px;" onclick="" />
</td>
</tr>
</table>
</div>
Sanket Prabhu
  • 2,232
  • 3
  • 20
  • 33
Xhalini
  • 25
  • 8

2 Answers2

0

Here You are talking about 2 different activity, It is not imp. that you are using Image/Button/or anything else. It only act as trigger to access database . It perform Some action after on click Event. " In your scenario action is "Retrieving Data" If you provide clear info about Database type you are using , then it is easier to explain soln.

Sanket Prabhu
  • 2,232
  • 3
  • 20
  • 33
0

Your are in client side and you have to communicate with the server to access the data you need. if you want to communicate with remote server you will have to call web services in your app using javascript.

You have to invoke a function with onclick event which performs required action,for this you can use Ajax. Refer the discussion

connecting to an external databse with phonegap-android app

Use AJAX to populate Cordova database

Community
  • 1
  • 1
redumpt
  • 167
  • 13
  • thanks for our time. I am stuck at UI part not the back-end part. I need help in selecting image as an option without a dropdown – Xhalini Nov 23 '15 at 13:14
  • i thought the question was regarding **unable** **to** **access** **data** **from** **database**. Anyway if you have new question post it as new question – redumpt Nov 24 '15 at 09:13