Start a new topic

MySQL Database Operation

MySQL Database Operation


Hello,

I have to make use of external datastorage.And for that purpose i am using MYSQL database. Please suggest me a way to do it.

Below is my way to do it though not succeeded:

I am creating a POST request from javascript file using jquery wrapper

var ajaxRequest= $.post( "insert.php", function(data) {

  alert( data );

})

  .fail(function() {

    alert( "error" );

  })

  .always(function() {

    alert( "finished" );

});

 

and in php file i am doing simple operation to respond with a data as follow:

<?php

echo 'Hello';

?>

Ideally this should  work and i should get "Hello" as the response. Please correct me if i am doing something wrong.

If you can suggest me a better way to perform database operation on mYSQL database from wikitude sdk that will be great.

 

Thanks,

Manish

Hi Manish!

Note that this forum focuses on AR related questions rather than JS/php/mySQL topics.

Please have a look at w3schools and other forums, like stackoverflow for that kind of questions.

Best regards,
Andreas

Hello Andreas,

 

Thank you for replyig back.

Why i posted this thread here is not for understanding php/mysql/javascript operations. Let me reframe my question to give you more clarity about the issue.

In wikitude AR world i am creating a button using a image resource and the ImageDrawable method. And then i making it clickable. Within the onclick event i am trying to 

connect to a php server and do certain operation on mysql database. For that purpose i am using  following jquery methods  $.ajax,$.post,$.get. But this piece of code doesn't work here.

Most important point is that to make sure that code inside button click event is correct i have seperately created a webpage and there i am trying to do the same operation and it works very well.

I am not sure why these jquery methods are not getting triggered within the javascript file. I am attaching the javascript file and the php file for you to give me a feedback. Please have a look.

Hi again!

Please check the following:

* did you include the required jQuery files in your index.html
* did you configue your endpoint in a way that it allows Access-Control-Allow-Origin ?
* Debug the webView to highlight potential JS (syntax) errors - Android Guide, iOS Guide

Best regards
Login or Signup to post a comment