Provides various official and user-released code examples and code reference. You are welcome to exchange and learn. I think many of my friends have been so confused. Anyway, I have been confused for a long time, when using TP to write the linkage function, you will find out how to pass the superior ID obtained using js to the Controller method using the U method to obtain the sublevel list. Return to the page. Like provinces and cities, switching provinces must obtain cities in the response provinces. I personally think my methods are fine, so I will share with you.
First, the JS variable is brought into the U method in the form of a string, and then it is OK to replace it with the js replacement function.
Var province_id = 3; // variable to be included
Var str = "{: U ('Article/getcity', array ('pid '=> 'vince _ id '))}"; // Add the variable to the U function as a string first
Str1 = str. replace ("province_id", province_id); // replace the string that replaces the variable with the real variable. OK!
$ ("# City_id"). load (str1 );
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB