⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Problem including ajax to Grocery Crud



chocovo

chocovo
  • profile picture
  • Member

Posted 01 May 2015 - 07:22 AM

Hello,

 

With document ready I can add javascript to edit page but there is something wrong in my code that I didn't resolved yet and I don't kknow how to do it.

 

On the top of the form there is a select "choose language".

 

Then, under it, I would like to use ajax to make a query a put using language chosen as parameter.

 

The problem I have is I don't know how to write the url of my model and the function that make the query.

 

This is my document ready code...

$content['documentready'] = "$(\"#field_nav_language_chzn .chzn-single\").change(function(){
   $.ajax({
      'url':<?php echo base_url() ?>models/Model_content/select_options($(\"field_nav_language_chzn .chzn-single\").val()),
      'success':function(response){
         $(\"#field_nav_parent_chzn .chzn-single\").value(response);
      }
   });
"

Does somebody made something like that or know where is the issue?

 

Thanks for all.

Best.


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 04 May 2015 - 18:22 PM

well you dont pass things directly to a model - rather u have to make a call to controller with whatever value u want to pass to it and what you want it to handle. The controller then will make the relevant call to the model and perform the desired action.


Vidhya Prakash

Vidhya Prakash
  • profile picture
  • Member

Posted 29 May 2015 - 14:02 PM

the same question me too have whether u solved @chocovo