Welcome Guest, Not a member yet? Register   Sign In
send by post an input loaded with ajax
#1

[eluser]Kamusksn[/eluser]
Hello, I'm developing a search module for a project

the user select an option from the "category" select, then by ajax I'm placing another select with the name "sub_category" and when I click "submit" I can only get the result of the first select.

is there a way of get the value of the ajax content by the POST method?
#2

[eluser]Flemming[/eluser]
Can you post some code for us to take a look at?
#3

[eluser]jvicab[/eluser]
If you use ajax, you don't need to submit the page.
I am assuming you have attached the ajax request to the onchange event for the first select element.
Just make sure the script you call returns a json encoded associative array of id => value pairs.
On success callback function, empty the previous second select element, get the array returned, and loop through it to build the set of options for the second select element.
#4

[eluser]Kamusksn[/eluser]
[quote author="jvicab" date="1410295466"]If you use ajax, you don't need to submit the page.
I am assuming you have attached the ajax request to the onchange event for the first select element.
Just make sure the script you call returns a json encoded associative array of id => value pairs.
On success callback function, empty the previous second select element, get the array returned, and loop through it to build the set of options for the second select element.[/quote]

Yes you are right, but I want just get values in base of the first select and submit by post category and sub-category to get results paginated with the pagination helper.

I have realized a simple test in other controller, I just created a simple form with two selects, an ajax call to fill the second select and submit the information by post method, and it works so I will check very closely my code...





Theme © iAndrew 2016 - Forum software by © MyBB