Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 979971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:18:15+00:00 2026-05-16T04:18:15+00:00

I am using cakePHP 1.26. I got an Input Text box which contains a

  • 0

I am using cakePHP 1.26.

I got an Input Text box which contains a URL and I want to submit the URL and stored it in the Database using Jquery AJAX.

Here is the HTML part:

<input type="text" id="testing" value="https://stackoverflow.com/questions/ask">

This is the JQuery part:

  var whatContent=$("#testing").val();
      var curl="http://localhost:8080/test/grab/"+whatContent;
      $.ajax({
      type: "POST",
      url: curl,   
      success: function(data) {    
      alert(data);}
      });

This is the code for the Action in the Controller:

function grab($w=null){
   if($w!=null){
     return $w;
    }
}

The code worked and I could see the Alert Message pop up, but there was something missing in the message. I mean I supposed to see the whole URL like this:

https://stackoverflow.com/questions/ask

But not, I just saw part of it instead:

http://stackoverflow.com

Later I altered the value in the Input Text box like this:

<input type="text" id="testing" value="https://stackoverflow.com/faq">

But again, the returned value was still

http://stackoverflow.com

cakePHP seemed to conside the URL as some parameters rather than a URL.

Please help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T04:18:16+00:00Added an answer on May 16, 2026 at 4:18 am

    When you append the content to the end of your “curl” variable like you are, you are attempting to add it to be retrieved through a GET variable and will get a result in a request like http://localhost:8080/test/grab/http://stackoverflow.com/questions/ask. Clearly this is an invalid request. Your GET variable parsing is not going to be consistent and a dangerous way of passing data back to your controller (especially if users will be able to edit the appended value).

    Instead, you should use the data attribute in jQuery to pass this information back in your POST request as described in the instructions here: http://api.jquery.com/jQuery.ajax/

    On the Cake side, you’ll be able to receive this value as $this->data['IDValueYouConfigured']. For example, if your AJAX request was like:

      var whatContent=$("#testing").val();
      var curl="http://localhost:8080/test/grab/";
      $.ajax({
      type: "POST",
      url: curl,
      data: "formValue="+whatContent,   
      success: function(data) {    
      alert(data);}
      });
    

    where formValue is the IDValueYouConfigured that I mentioned earlier.

    More importantly, you seem to be misunderstanding proper use of the Cake framework and could be performing all of these functions MUCH more simply using things like the JsHelper, FormHelper, etc. I would recommend using the most RECENT version of Cake (1.3.3) and follow through the Blog tutorial at least once. This will lead to better questions which will be more likely to get helpful answers. Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using cakePHP 1.26. In a controller, I got a function which contains
I am using CakePHP 1.26 and CDN JQuery in this URL: http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js In a
I am using CakePHP and want to create a URL to a controller/view without
I'm using cakephp 2.1 just fine; I want to use jquery to have my
http://localhost/cakephp/users i got a error when i am using this url Error : UsersController
Currently I'm deal with a history message page using Cakephp.And I got a problem
Im using cakephp 2.0 and i have data submitted that i want to cleanup,
I am using CakePHP. I created an external class which is not a model
I'm using CakePHP 2.0. Is it possible to display multiple fields in select/dropdown box
I am using cakephp v1.26. I got a function in a controller like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.