Search found 9 matches

Page 1 of 1

Search found 9 matches

Re: Problem with reading JSON

It just appears here. Actually I'm just mimicking what opencart has done to create a form!

Jump to post
  • Sat Feb 24, 2018 6:24 am
  • Replies 19
  • Views 18728
Re: Problem with reading JSON

<input type="text" name="productcode" value="<?php echo $productcode; ?>" id=" input-productcode " class="form-control" readonly/> Where does this ID come from? It comes from a php file in controller: if (isset($this->request->get['productcode'])) {...

Jump to post
  • Sat Feb 24, 2018 6:16 am
  • Replies 19
  • Views 18728
Re: Problem with reading JSON

Then, what is your HTML source code containing the productcode? here it is: <div class="form-group"> <label class="col-sm-2 control-label" for="input-productcode"><?php echo $entry_productcode; ?></label> <div class="col-sm-5"> <input type="text" na...

Jump to post
  • Sat Feb 24, 2018 5:56 am
  • Replies 19
  • Views 18728
Re: Problem with reading JSON

straightlight wrote:
Sat Feb 24, 2018 5:02 am
Also, ensure to include the token key and value in your jQuery URL if this solution is being used from the admin.
no, I'm not working on the admin part. It seems that everything is working except that the java code is not returning the value to the php code ???

Jump to post
  • Sat Feb 24, 2018 5:38 am
  • Replies 19
  • Views 18728
Re: Problem with reading JSON

Thanks straightlight.I really appreciate you guys help. I used your code (I changed some parts because I've created the model in localisation folder) but still no answer. With an "alert(JSON.stringify(json)); " I get the same answer either with my code or yours.

Jump to post
  • Sat Feb 24, 2018 4:50 am
  • Replies 19
  • Views 18728
Re: Problem with reading JSON

Put the string below before html = json['code'] (BTW, you don't need this string at all) in "success" part of your AJAX function: alert(JSON.stringify(json)); Remember this debugging technique, it lets you to print a nice looking array in JS alert popup. Thanks again, I think I'm getting ...

Jump to post
  • Sat Feb 24, 2018 4:09 am
  • Replies 19
  • Views 18728
Re: Problem with reading JSON

thekrotek wrote:
Sat Feb 24, 2018 3:31 am
Try to debug it using alert() and JSON.stringify functions, see, what is returned on your AJAX request.
Thanks a lot thekrotek! I'm not really good in using JSON and ajax. May you please let me know how and where to use alert() and JSON.stringify functions?

Jump to post
  • Sat Feb 24, 2018 3:39 am
  • Replies 19
  • Views 18728
Re: Problem with reading JSON

Thanks for your prompt answer. I checked the mySQL field and it seems OK! Personally I think the problem is with this part of the code but I can't understand where: success: function(json) { html = json['code']; $('input [name=\'productcode\']').html(html); }, and here is the model file for the getP...

Jump to post
  • Sat Feb 24, 2018 3:22 am
  • Replies 19
  • Views 18728
Problem with reading JSON

I'm trying to build a form page that for example by choosing a product from a drop-down menu, the product abbreviation is read automatically from database and is filled in a menu underneath of drop-down menu (this is something similar to what is done in registration form when by choosing a country, ...

Jump to post
  • Sat Feb 24, 2018 1:41 am
  • Replies 19
  • Views 18728

Page 1 of 1

Search found 9 matches