Answer the question
In order to leave comments, you need to log in
Ajax + Routing?
with an ajax request, I prescribe a route that refers to the controller, in which there is already a ready-made method, but there is no connection
already checked everything 15 times, everything seems to be correct
- the routes work here -
; Конфигурационный файл - карта УРЛ, именно здесь определяется как будут выглядеть урл на вашем сайте
; Секции - определения УРЛ, директивы - имена переменных и различные условия для них.
; Например чтобы УРЛ: http://www.example.com/news/2006/03/21
; запускал контроллер "news" с действием "list" и параметрами year, month и day (для $_GET).
; Напишите следующее правило
; [news/@year/@month/@day => news#list]
; require_regex.year = /^\d{4}$/
; require_regex.month = /^\d{1,2}$/
; require_regex.day = /^\d{1,2}$/
;
; Для создания именованных мапов используется запись вида
; [products:products/list => products#list]
; [product:product/@id => products#view]
; Далее в коде программы можно будет использовать функции помощники вида products_url(), products_path() и product_url(1342), product_path(1342)
[regions/region_search => card#region_search] //мой роут где card-контрллер/region_search - метод
if (action() == 'region_search'){
if(isset($_POST['data'])){
$referal = $_POST['data'];
}
}
Answer the question
In order to leave comments, you need to log in
What do you mean by "no connection"? What response from the server comes with what headers and statuses?
Perhaps these links are for following them inside the browser, and not API methods?
API methods should generally return JSON objects and are not meant to be navigated from a browser
- open the browser console, go to the network tab
- turn on XHR requests
- poke into your ajax and see what went, where it went and what was said from the server.
- After that, we think - whether we went there and whether we got it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question