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 1053153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:12:30+00:00 2026-05-16T17:12:30+00:00

I’m somewhat new to Ajax/Jquery, so I apologize if this is an easy question,

  • 0

I’m somewhat new to Ajax/Jquery, so I apologize if this is an easy question, but I just couldn’t figure it out.

I am using CakePHP and JQuery.

I want to save a link, label, and description into a table by pulling out the “innerHTML” from an HTML page. I can’t seem to put the data in the expected format – that is the format that the controller expects.

I am pulling the data from html, the html is like this:

<div class="listing">
 <ul>
   <li class="link">www.yahoo.com</li>
   <li class="label">Yahoo</li>
   <li class="description">This is Yahoo's home page</li>
   </ul>
</div>
...   

I can parse the HTML and get my “link”, “label”, and “description”.

But, when I post the data to the controller, I can’t figure out how to get the data in the expected format.

After pulling the data into variables with JavaScript (JQuery), I post it using the following JQuery function:

$.post("/links/save", {link: link, label: label, notes: description});

When the data posts to the controller, the format of the data is:

(
  [form] => Array
  (
    [link] => www.yahoo.com
    [label] => Yahoo
    [description] => This is Yahoo's home page
  )
)

The format that the controller expects the data is:

(
  [data] => Array
  (
    [Link] => Array
    (
      [link] => www.yahoo.com
      [label] => Yahoo
      [description] => This is Yahoo's home page
    )
  )
)

I know I can take the data as it is and put it in the proper format in the controller, but it seems like that is unnecessary.

Can someone please tell me how to manipulate the data in the JQuery so that it posts as the controller expects it?

  • 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-16T17:12:30+00:00Added an answer on May 16, 2026 at 5:12 pm

    There’s still PHP in CakePHP, so you can simply use $_POST.

    It may be more convenient to stick to Cake’s data structures though, so to get $this->data populated automatically you have to format the data like this:

    { data : { ModelName : { link : ..., ... } } }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This could be a duplicate question, but I have no idea what search terms
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.