The House and Senate approved stopgap legislation Thursday meant to avert a partial government shutdown ahead of a midnight Friday deadline.

The bill, also known as a continuing resolution, would keep federal agencies functioning for an additional two weeks through Dec. 22.

The White House indicated Thursday that Trump will sign the spending extension and laid out its goals for the upcoming budget bargaining. It said money for the military including missile defense and security along the border with Mexico “must be prioritized in a long-term funding agreement.”

The bill passed the House 235-193, with 18 Republicans voting against it and 14 Democrats voting for it. The Senate vote was 81-14. Sens. Elizabeth Warren, D-Mass.; Bernie Sanders, I-Vt.; Ted Cruz, R-Texas; and John McCain, R-Ariz., were among those who cast “no” votes.

While the bill keeps the government running for now, it would set up a pre-Christmas showdown later this month. The legislation is aimed at giving negotiators more time to settle differences. The measure also makes money available to several states that are running out of funds for the Children’s Health Insurance Program, a widely popular program that provides medical care to more than eight million children.

On Thursday afternoon, Trump and the so-called “Big Four” congressional leaders—Senate Majority Leader Mitch McConnell, R-Ky.; Senate Minority Leader Chuck Schumer, D-N.Y.; House Speaker Paul Ryan, R-Wis.; and House Minority Leader Nancy Pelosi, D-Calif., met at the White House to discuss a strategy to avoid a government shutdown after the stopgap expires.

Pelosi had told reporters Thursday that lawmakers “will not leave here” without a deal to help immigrants who came to the U.S. illegally as children and are enrolled in the Deferred Action Childhood Arrivals (DACA) program, which Trump ended three months ago.

White House press secretary Sarah Sanders said Trump, Ryan and McConnell agreed that negotiations on immigration “should be held separately on a different track, and not as part of the government funding bill.” Sanders also said that Trump “reiterated his priorities for ensuring any immigration package ends chain migration, constructs a border wall, and substantially strengthens immigration enforcement to stop illegal immigration and visa overstays.”

McConnell and Ryan issued a joint statement calling the meeting with Trump “productive,” and added that they “stressed the need to address border security, interior enforcement and other parts of our broken immigration system and that this should be a separate process and not used to hold hostage funding for our men and women in uniform.”

In a joint statement of their own, Schumer and Pelosi said the group “had a productive conversation on a wide variety of issues. Nothing specific has been agreed to, but discussions continue.”

Most House Democrats opposed the short-term bill, but more than enough supported it in the Senate to allow its passage. Democrats are expected to use their leverage to insist on future spending boosts for health care, infrastructure and other domestic programs that would match increases Republicans want for defense.

Trump unexpectedly tossed a political hand grenade into the mix when he told reporters that a shutdown “could happen” and blamed Democrats. He said they want “illegal immigrants pouring into our country, bringing with them crime, tremendous amounts of crime.”

In response, Pelosi tweeted that Trump was “the only person talking about a government shutdown.”

Last week, the president invited the same group to the White House to discuss a bipartisan budget deal – but Schumer and Pelosi decided not to show.

Trump accused the Democratic leaders of being “all talk” and “no action.”

“And now, it’s even worse. Now it’s not even talk. So they’re not showing up for the meeting,” Trump told reporters last week. The president was sure to keep two empty seats with the Democratic leaders’ name tags on either side of him in an apparent effort to shame them for boycotting the meeting.

Fox News’ Serafin Gomez and The Associated Press contributed to this report.

Brooke Singman is a Politics Reporter for Fox News. Follow her on Twitter at @brookefoxnews.