English 中文(简体)
使用AJAX jQuery的基本Qn?
原标题:Basic Qn using AJAX jQuery?

我刚刚开始与《刑法》编辑一道学习。 我认为,我有一个文字区和一个纽芬兰州,利用AJAX向我的控制员提交文本,从数据库中检索数据,并将这一数据反馈给我。 然而,我正在拿回机功能中的“分散关键特性”错误。 即便是当我只读了<条码>。 正在发生什么?

Btw,我是否应当使用<代码>return$result,或echo$result,以便把数据反馈到网页?

AJAX

$(function() {
    $("#search_button").click(function(e){
        e.preventDefault();
        var search_location = $("#search_location").val();
        $.get( index.php/main/get_places , search_location, function(data){
            $("#result").html(data);
            console.log(data);
    iii
iii

iii

<><><><><>><>>>><>>>>>>

function get_places($address) {

    $search_latlng = $this->geocode_address($address);
    $this->load->model( main_model.php );
    $result = $this->main_model->get_places($search_latlng);

    echo "test";
}
最佳回答

CodeIgniter has restricted the characters in the url to:

$config[ permitted_uri_chars ] =  a-z 0-9~%.:_- ; //Inside config.php

当你发出美国宇宙航空研究开发机构的请求时,你就把这份名单放在了名单上。 我建议将<代码>$.get改为$.post/code>,然后将员额数据从控制器中删除。 与此类似:

<>AJAX

$(function() {
    $("#search_button").click(function(e){
        e.preventDefault();
        var search_location = $("#search_location").val();
        $.post( index.php/main/get_places , { search_location : search_location}, function(data){
            $("#result").html(data);
            console.log(data);
        });
    });
});

<><><><><>><>>>><>>>>>>

function get_places() {
    $address = $this->input->post( search_location );
    $search_latlng = $this->geocode_address($address);
    $this->load->model( main_model.php );
    $result = $this->main_model->get_places($search_latlng);

    echo $result;
}

As for the echo vs return, use echo.

问题回答

你也许不能允许你在URL和Ajax职能中提出质询,这增加了对ur的质疑。 考察一下下面的节奏,以了解如何回答关于下列问题的提问:





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.